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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2022-03-30 00:00:00         |2022-4-18
                 CC|                            |iains at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org
             Status|WAITING                     |NEW
           Keywords|                            |ice-on-valid-code

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
Initial analysis - perhaps some issue with constexpr processing:

When we have a void await_return() in  the final_awaiter class:

 final.suspend:
 frame_ptr->_Coro_resume_fn = 0B;
 {
 struct final_awaiter Fs [value-expr: frame_ptr->Fs_1_2];

 frame_ptr->_Coro_resume_index = 4;
 _15 = &frame_ptr->_Coro_self_handle;
 D.9844 = std::__n4861::coroutine_handle<return_object::promise_type>::operator
std::__n4861::coroutine_handle<void> (_15);
 return_object::promise_type::final_awaiter::await_suspend (D.9844);
 D.9768 = .CO_YIELD (4, 1, &resume.4, &destroy.4, frame_ptr);
 retval.2 = D.9768;
 switch (retval.2) <default: <D.9771>, case 0: <D.9769>, case 1: <D.9770>>
 <D.9769>:
 .CO_SUSPN (&actor.suspend.ret);
 <D.9770>:
 goto resume.4;
 <D.9771>:
 goto destroy.4;
 destroy.4:
 goto coro.delete.promise;
 resume.4:
 return_object::promise_type::final_awaiter::await_resume ();
 }

when the await_resume() function is made to return an int.

 final.suspend:
 frame_ptr->_Coro_resume_fn = 0B;
 {
<snip>
 destroy.4:
 goto coro.delete.promise;
 resume.4:
 }

So we have a dangling label at the end of that scope (which then gives rise to
the crash).

* If I remove the 'contexpr' from the await_resume() function, then it all
works as expected.

* AFAICT, the content is correct in "expand_one_await_expression()".

* Altering the coroutines code to cast the result of the await_resume() to void
makes no difference.

Reply via email to