From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 678433858C20; Wed, 26 Jan 2022 18:35:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 678433858C20 From: "jason at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103984] [12 regression] Possible maybe-uninitialized false positive on shaderc-2021.0 since r12-6329 Date: Wed, 26 Jan 2022 18:35:51 +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.0 X-Bugzilla-Keywords: diagnostic, EH X-Bugzilla-Severity: normal X-Bugzilla-Who: jason at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jan 2022 18:35:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103984 --- Comment #5 from Jason Merrill --- (In reply to Sergei Trofimovich from comment #0) > input_files.emplace_back(Z{ > arg.str(), // what is the lifetime of this temporary? This prvalue initializes the 'name' member of the Z temporary, there is no separate string temporary. > to_stage(arg), // why does this constructor matter? My fix for PR66139 fixed EH in aggregate initialization so that if evaluati= on of to_stage(arg) throws, we properly destroy the previously initialized 'na= me' member. That's the difference pinskia mentions. It is surprising that we warn with a user-provided copy constructor and don= 't with a defaulted constructor. It changes the code a bit because it means string_piece isn't trivially copyable, so we need to create a string_piece temporary for passing to to_stage instead of passing arg directly by bitwise copy, but I don't know why that would confuse the optimizers into thinking = that _M_p might be uninitialized.=