From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4236E3858C78; Fri, 19 Jan 2024 17:35:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4236E3858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705685748; bh=eoISjAKj1DuqKCFry/P0BMpQAamG02pkFuzNGT1B6hM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vVZdpbAxzBNQu2zd4FEmon+wwoiFyL712w7ADTdr6+P9qKERYh8aX/gQ4LhUbSAgP kflX0YEOWapRsiX5cnDumaBOhNtaJJvlpmh+gNc++qGWTAqHJVF18J4+ijmwTsamgl FhcEKrTf5D25Z08GZ/baAjVDoG7cSts488lBhCYc= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109671] Spurious dangling reference warning in GCC 13 Date: Fri, 19 Jan 2024 17:35:47 +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: 13.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution cc bug_status 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=3D109671 Marek Polacek changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE CC| |mpolacek at gcc dot gnu.org Status|UNCONFIRMED |RESOLVED --- Comment #5 from Marek Polacek --- (In reply to Patrick J. LoPresti from comment #3) > (In reply to Andrew Pinski from comment #1) > > There is no way for GCC to know that get_foo_by_name does not store the > > argument into what is returned so it warns about this case ... >=20 > To summarize: >=20 > GCC is warning because it does not and cannot know whether I am managing > object lifetimes correctly. >=20 > The only way to silence the warning is to modify my code to make it uglie= r, > into a form where GCC still does not and cannot know whether I am managing > lifetimes correctly. >=20 > So is this a valid bug report, or not? It's valid but also I don't think I can tweak the heuristic not to warn her= e.=20 There ought to be a simpler way to suppress the warning, see bug 109642. *** This bug has been marked as a duplicate of bug 109642 ***=