https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113773
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Iain D Sandoe <ia...@gcc.gnu.org>: https://gcc.gnu.org/g:54846260bf9ac1e6253f3ce7ffa7baca049efcdd commit r14-11784-g54846260bf9ac1e6253f3ce7ffa7baca049efcdd Author: Iain Sandoe <i...@sandoe.co.uk> Date: Mon May 12 16:57:54 2025 +0100 c++, coroutines: Fix handling of early exceptions [PR113773]. This is a GCC-14 version of the same strategy as used on trunk, but with the more wide-ranging code cleanups elided. Since the return expression could throw, but after the frame is destroyed, we must also account for this, in addition to whether initial await_resume has been called. PR c++/113773 gcc/cp/ChangeLog: * coroutines.cc (coro_rewrite_function_body): Do not set initial_await_resume_called here. (morph_fn_to_coro): Set it here, and introduce a new flag that indicates we have not yet reached the ramp return. Gate the EH cleanups on both of these flags. gcc/testsuite/ChangeLog: * g++.dg/coroutines/torture/pr113773.C: New test. Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>