From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6A5743884F97; Thu, 8 Dec 2022 18:35:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A5743884F97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670524510; bh=Pnyg69zKtKmF7PHonHR1vB8Pc87+HiOaN+pqR4jIiPs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TppGB9yJLHqm0alQnhLM/JMgw4lHz91u61sz8RvbgKHD/XUiFLQ9kTcSMoupZ9Tu+ ySH230iBq/ltn8HMiLb75sNjQlDkAMEOi6Og5Fc9tH+bi1fPlQPi7xtCeJGiGThKe2 GREWAer5PnKOgRUxZ9HawStJzppaC/abPDYcvZ4o= 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:34:58 +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 #17 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:1e1847612d7f169f82c985b0b3a5e3301d6fe999 commit r13-4563-g1e1847612d7f169f82c985b0b3a5e3301d6fe999 Author: Jason Merrill Date: Mon Dec 5 15:19:27 2022 -0500 c++: fewer allocator temps [PR105838] In this PR, initializing the array of std::string to pass to the vector initializer_list constructor gets very confusing to the optimizers as t= he number of elements increases, primarily because of all the std::allocat= or temporaries passed to all the string constructors. Instead of creating= one for each string, let's share an allocator between all the strings; we c= an do this safely because we know that std::allocator is stateless and that string doesn't care about the object identity of its allocator parameter. PR c++/105838 gcc/cp/ChangeLog: * cp-tree.h (is_std_allocator): Declare. * constexpr.cc (is_std_allocator): Split out from... (is_std_allocator_allocate): ...here. * init.cc (find_temps_r): New. (find_allocator_temp): New. (build_vec_init): Use it. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/allocator-opt1.C: New test.=