public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-8319] c++, coroutines: Partial reversion of r12-8308-g15a176a833f23e [PR105426].
@ 2022-04-29  8:29 Iain D Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2022-04-29  8:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7cc5a20ba3f05a783fb75762cfb77ccb571285ab

commit r12-8319-g7cc5a20ba3f05a783fb75762cfb77ccb571285ab
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Thu Apr 28 20:06:29 2022 +0100

    c++, coroutines: Partial reversion of r12-8308-g15a176a833f23e [PR105426].
    
    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.
    
    We avoid the use of DECL_UID to build anonymous symbols since that might not
    be stable for -fcompare-debug.
    
    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.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
            PR c++/105426
    
    gcc/cp/ChangeLog:
    
            * coroutines.cc (register_local_var_uses): Allow promotion of unnamed
            temporaries to coroutine frame copies.
    
    (cherry picked from commit 3d8d093e820b10a4b4b2af8949a368377c0888cb)

Diff:
---
 gcc/cp/coroutines.cc | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index 551ddc9cc41..1d886b31c77 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -3913,6 +3913,7 @@ register_local_var_uses (tree *stmt, int *do_subtree, void *d)
   if (TREE_CODE (*stmt) == BIND_EXPR)
     {
       tree lvar;
+      unsigned serial = 0;
       for (lvar = BIND_EXPR_VARS (*stmt); lvar != NULL;
 	   lvar = DECL_CHAIN (lvar))
 	{
@@ -3973,14 +3974,15 @@ 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", lvd->nest_depth, lvd->bind_indx,
+			     serial++);
+
 	  /* TODO: Figure out if we should build a local type that has any
 	     excess alignment or size from the original decl.  */
-	  if (buf)
-	    {
-	      local_var.field_id = coro_make_frame_entry (lvd->field_list, buf,
-							  lvtype, lvd->loc);
-	      free (buf);
-	    }
+	  local_var.field_id = coro_make_frame_entry (lvd->field_list, buf,
+						      lvtype, lvd->loc);
+	  free (buf);
 	  /* We don't walk any of the local var sub-trees, they won't contain
 	     any bind exprs.  */
 	}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-29  8:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29  8:29 [gcc r12-8319] c++, coroutines: Partial reversion of r12-8308-g15a176a833f23e [PR105426] Iain D Sandoe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).