https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116775
Arsen Arsenović <arsen at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2024-09-20
Status|UNCONFIRMED |NEW
CC| |arsen at gcc dot gnu.org
--- Comment #2 from Arsen Arsenović <arsen at gcc dot gnu.org> ---
indeed, this happens because the processing of constant_p happens after we
split the coroutine up, it'd seem, so we get this:
if (<<cleanup_point !awaitable::await_ready (&Aw0)>>)
{
<<cleanup_point <<< Unknown tree: expr_stmt
(void) (_Coro_resume_index = 4) >>>>>;
if (<<cleanup_point !awaitable::await_suspend (&Aw0, TARGET_EXPR
<D.9414, std::__n4861::coroutine_handle<Task::promise_type>::operator
std::__n4861::coroutine_handle<void> (&_Coro_self_handle)>)>>)
{
<<cleanup_point <<< Unknown tree: expr_stmt
.CO_SUSPN (&coro.restart.dispatch) >>>>>;
}
switch (<<cleanup_point .CO_YIELD (4, 0, &resume.4, &destroy.4,
frame_ptr)>>)
{
case 0:;
<<cleanup_point <<< Unknown tree: expr_stmt
.CO_SUSPN (&actor.suspend.ret) >>>>>;
case 1:;
goto resume.4;
default:;
goto destroy.4;
}
destroy.4:;
goto coro.delete.promise;
}
resume.4:;
<<cleanup_point <<< Unknown tree: expr_stmt
(void) 0 >>>>>;
... that last line is supposed to be an await_resume call, but it got folded to
zero (because it's not a constant, and the coroutine code generated
__builtin_constant_p (Aw0.await_resume ()).
confirmed