From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 86094385734D; Thu, 28 Apr 2022 18:55:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86094385734D From: "iains at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105426] [wrong-code][regression][coroutines] range-for temporaries are not persisted in coroutines Date: Thu, 28 Apr 2022 18:55:15 +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.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: iains at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: iains at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to cf_reconfirmed_on everconfirmed 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 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: Thu, 28 Apr 2022 18:55:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105426 Iain Sandoe changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |iains at gcc dot gn= u.org Last reconfirmed| |2022-04-28 Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED --- Comment #2 from Iain Sandoe --- So the fix for PR105287 was too ambitious - and reveals that we are missing= to name some variables that should be promoted. Rather than delay for a second fix, the proposal would be a partial reversi= on of r12-8308-g15a176a833f23e, like so (which would be more suitable for the branch). This does fix the new issue (and still fixes the analyser one) in= my local testing. diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index 551ddc9cc41..2e393b2cddc 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -3973,6 +3973,9 @@ register_local_var_uses (tree *stmt, int *do_subtree, void *d) else if (lvname !=3D NULL_TREE) buf =3D xasprintf ("%s_%u_%u", IDENTIFIER_POINTER (lvname), lvd->nest_depth, lvd->bind_indx); + else + buf =3D xasprintf ("_D%u_%u_%u", DECL_UID (lvar), lvd->nest_dep= th, + lvd->bind_indx); /* TODO: Figure out if we should build a local type that has any excess alignment or size from the original decl. */ if (buf)=