https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126884
Bug ID: 126884
Summary: [coroutine] incorrect coroutine promise lifetime when
unhandled_exception() rethrows
Product: gcc
Version: 14.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bootmgr at 163 dot com
Target Milestone: ---
This is an additional issue found while investigating the example from
https://github.com/cplusplus/CWG/issues/574.
Godbolt reproducer:
https://godbolt.org/z/E75zs44cd
Starting with GCC 14.3, when promise_type::unhandled_exception() rethrows the
current exception, the coroutine appears to construct the promise twice but
destroy it only once. The generated behavior differs from GCC 14.2 and from
Clang/MSVC.
This looks like a regression in coroutine frame or promise lifetime handling,
specifically when an exception escapes from unhandled_exception().