From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CF490394C831; Mon, 5 Dec 2022 20:58:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF490394C831 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670273898; bh=Q6U2bkeRJkcJ9x8jxFgGrjc+AhyHguiv6PeuU1V7k4g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cV6v/3CUtnlh/7tUh5iugQ3KPLDy8+O76VjhBv5aG0Wnzx4PoZ4TTRLAVBq8XYrIg U0d55Np8sKfpoTYCBHnnvoD9tf9dTYm9jGroIH1ShP43AjTTKwtRd6OyjFR64xIagh ZVxcqN6JF6JEVnASkQvD2ms7NR/KNmb8P597HH1M= From: "jason at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105838] [10/11/12/13 Regression] g++ 12.1.0 runs out of memory or time when building const std::vector of std::strings Date: Mon, 05 Dec 2022 20:58:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: compile-time-hog, memory-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: jason at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105838 --- Comment #13 from Jason Merrill --- (In reply to Jakub Jelinek from comment #11) > Even if we don't emit a loop (which I still think is the way to go for > larger initializers because anything else means just too large code), can= 't > there for the larger initializers simply be some variable holding a count= er > how many initializers have been already initialized and a single EH region > that will perform all the cleanups based on that counter? We already do that for cleaning up the array itself; the problem is any temporaries created while initializing array elements. That's why I was thinking about a parallel array of temporaries. Though that would only wor= k if all the element initializers construct the same temporaries, which is true = in this case but not in general. But really I think we should try to avoid constructing an array of std::str= ing in the first place, as in comment #12.=