https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101118

--- Comment #14 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #13)
> > So .. for promotion of target expression temporaries to frame vars, one of:
> >  - a) we need to find a different way to name them
> I think we can just count number of fields within a given frame type?

yeah I made a hack that did this (and resolves this PR) but I'd think we can
find something neater, I'd like to c++-ify the sources some more, and create a
class to manage the frame... ( maybe for GCC14 now ).

-----


diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index 7f8cbc3d95e..bb65d41ce18 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -271,6 +271,8 @@ static GTY(()) tree coro_traits_templ;
 static GTY(()) tree coro_handle_templ;
 static GTY(()) tree void_coro_handle_type;

+static unsigned tmpno = 0;
+
 /* ================= Parse, Semantics and Type checking ================= */

 /* This initial set of routines are helper for the parsing and template
@@ -2882,7 +2884,7 @@ flatten_await_stmt (var_nest_node *n, hash_set<tree>
*promoted,
          tree init = t;
          temps_used->add (init);
          tree var_type = TREE_TYPE (init);
-         char *buf = xasprintf ("D.%d", DECL_UID (TREE_OPERAND (init, 0)));
+         char *buf = xasprintf ("T%03u", tmpno++);
          tree var = build_lang_decl (VAR_DECL, get_identifier (buf),
var_type);
          DECL_ARTIFICIAL (var) = true;
          free (buf);
@@ -4367,6 +4369,7 @@ morph_fn_to_coro (tree orig, tree *resumer, tree
*destroyer)
 {
   gcc_checking_assert (orig && TREE_CODE (orig) == FUNCTION_DECL);

+  tmpno = 0;
   *resumer = error_mark_node;
   *destroyer = error_mark_node;
   if (!coro_function_valid_p (orig))

Reply via email to