The changes to fix PR 105287 included a tightening of the constraints on which
variables are promoted to frame copies.  This has exposed that we are failing
to name some variables that should be promoted.

The long-term fix is to address the cases where the naming has been missed,
but for the short-term (and for the GCC-12 branch) backing out the additional
constraint is proposed.

This makes the fix for PR 105287 more conservative.

tested on x86_64-darwin, with the reproducer from the PR which now produces
the correct output for both optimised and unoptimised code.

OK for master?
OK for GCC-12?
thanks,
Iain

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)
-- 
2.24.3 (Apple Git-128)

Reply via email to