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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <ia...@gcc.gnu.org>:

https://gcc.gnu.org/g:368ba7aed46d57d093c0180baae4dc0e0ba468b6

commit r15-3649-g368ba7aed46d57d093c0180baae4dc0e0ba468b6
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Fri Sep 6 20:59:43 2024 +0100

    c++, coroutines: Fix handling of bool await_suspend() [PR115905].

    As noted in the PR the action of the existing implementation was to
    treat a false value from await_suspend () as equivalent to "do not
    suspend".  Actually it needs to be the equivalent of "resume" - and
    we need to restart the dispatcher - since the await_suspend() body
    could have already resumed the coroutine.
    See also https://github.com/cplusplus/CWG/issues/601 (NAD) for more
    discussion.

    Since we need to amend the await expansion and the actor build, take
    the opportunity to clean up and modernise the code there.  Note that
    we need to make the jump back to the dispatcher without any scope
    exit cleanups (so we have to use the .CO_SUSPN IFN to do this).

            PR c++/115905

    gcc/cp/ChangeLog:

            * coroutines.cc (struct coro_aw_data): Add a member for the
            restart dispatch label.
            (expand_one_await_expression): Rework to modernise and to
            handle the boolean await_suspend() case.
            (build_actor_fn): Rework the dispatcher and allow for a jump
            back to the dispatcher.

    gcc/testsuite/ChangeLog:

            * g++.dg/coroutines/torture/pr115905.C: New test.

    Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>

Reply via email to