On Thu, Apr 28, 2022 at 08:17:04PM +0100, Iain Sandoe wrote: > Signed-off-by: Iain Sandoe <i...@sandoe.co.uk> > > PR c++/105426 > > gcc/cp/ChangeLog: > > * coroutines.cc (register_local_var_uses): Allow promotion of unnamed > temporaries to coroutine frame copies. > --- > gcc/cp/coroutines.cc | 3 +++ > 1 file changed, 3 insertions(+) > > 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)
This isn't going to play well with -fcompare-debug. We don't guarantee same DECL_UID values between -g and -g0, just that when two decls are created with both -g and -g0 they compare the same, but with -g the gap in between them could be larger. So names that include DECL_UID will be often different between -g and -g0. Can't the FIELD_DECL be instead nameless? Say change coro_make_frame_entry to do tree id = name ? get_identifier (name) : NULL_TREE; instead of tree id = get_identifier (name); ? Jakub