[Bug c++/105426] [wrong-code][regression][coroutines] range-for temporaries are not persisted in coroutines
iains at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Apr 28 18:55:15 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105426
Iain Sandoe <iains at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |iains at gcc dot gnu.org
Last reconfirmed| |2022-04-28
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
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 reversion
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 != NULL_TREE)
buf = xasprintf ("%s_%u_%u", IDENTIFIER_POINTER (lvname),
lvd->nest_depth, lvd->bind_indx);
+ else
+ buf = xasprintf ("_D%u_%u_%u", DECL_UID (lvar), lvd->nest_depth,
+ 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)
More information about the Gcc-bugs
mailing list