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

--- Comment #3 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:efc99ab2d5fdb7f2a942199b0e5b16e1e2bb8c27

commit r15-3150-gefc99ab2d5fdb7f2a942199b0e5b16e1e2bb8c27
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Sat Aug 17 12:49:41 2024 +0100

    c++, coroutines: Fix handling of early exceptions [PR113773].

    The responsibility for destroying part of the frame content (promise,
    arg copies and the frame itself) transitions from the ramp to the
    body of the coroutine once we reach the await_resume () for the
    initial suspend.

    We added the variable that flags the transition, but failed to act on
    it.  This corrects that so that the ramp only tries to run DTORs for
    objects when an exception occurs before the initial suspend await
    resume has started.

            PR c++/113773

    gcc/cp/ChangeLog:

            * coroutines.cc
            (cp_coroutine_transform::build_ramp_function): Only cleanup the
            frame state on exceptions that occur before the initial await
            resume has begun.

    gcc/testsuite/ChangeLog:

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

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

Reply via email to