From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5CC78389BCA1; Thu, 8 Dec 2022 18:41:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CC78389BCA1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670524886; bh=VcEV9lwNAXtYaOOd9fqAYggKPESJTD2UAcx2U8vPIag=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ib+USDRTXtkIxwxKkvnOa3ffDAPpnL5aI3RFXQ+bR3k5JbPwxAlj1eVqyJ2dk3uqC Mb1rFvnXBPIlyXK1mRCJfARBnB+a/eNlws56tPoChxFtLcMGJswIESrR3bhdWS6AfY HcFBA7+zZqrhKe7G43UJNcr7OBucENv3fuwUnDEY= From: "cvs-commit 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: Thu, 08 Dec 2022 18:41:25 +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: cvs-commit 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 #18 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:d081807d8d70e3e87eae41e1560e54d503f4d465 commit r13-4564-gd081807d8d70e3e87eae41e1560e54d503f4d465 Author: Jason Merrill Date: Tue Dec 6 09:51:51 2022 -0500 c++: avoid initializer_list [PR105838] When constructing a vector from { "strings" }, first is built an initializer_list, which is then copied into the strings in the vector. But this is inefficient: better would be treat the { "strings"= } as a range and construct the strings in the vector directly from the string-literals. We can do this transformation for standard library classes because we know the design patterns they follow. PR c++/105838 gcc/cp/ChangeLog: * call.cc (list_ctor_element_type): New. (braced_init_element_type): New. (has_non_trivial_temporaries): New. (maybe_init_list_as_array): New. (maybe_init_list_as_range): New. (build_user_type_conversion_1): Use maybe_init_list_as_range. * parser.cc (cp_parser_braced_list): Call recompute_constructor_flags. * cp-tree.h (find_temps_r): Declare. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/initlist-opt1.C: New test.=