[Bug c++/126884] New: [coroutine] incorrect coroutine promise lifetime when unhandled_exception() rethrows

bootmgr at 163 dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
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().
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.