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

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> ---
Initial analysis ...

1. The coroutines code is supposed to ensure that the local variables are given
the context of the enclosing function (whether that is the ramp or the outlined
actor).

coroutines.cc:
   2023           /* Re-write the variable's context to be in the actor func. 
*/
   2024           DECL_CONTEXT (lvar) = lvd->context;

So, one issue to resolve is why that is apparently not working for the
temporary condition variable in question.

2. DECL_CONTEXT can validly be NULL_TREE (when the decl is in the global
namespace)

GCC internals:

DECL_CONTEXT
This macro returns the enclosing namespace. The DECL_CONTEXT for the
global_namespace is NULL_TREE.

Both things need to be addressed (even if fixing [1] will make the ICE go away
for this code, there will surely be code that intentionally places vars in the
global namespace).

====

FWIW, I looked at the output of the analyser with my WIP branch (for which the
ICE does not fire) - and TBH suspect that it will not be terribly useful until
we can teach it about the outlining done for coroutines (the fact that some
values persist, intentionally, beyond the closing brace of the initial call is
going to be an interesting thing to figure out).

Reply via email to