]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: don't remove labels during coro-early-expand-ifns [PR105104]
authorArsen Arsenović <arsen@aarsen.me>
Fri, 16 Aug 2024 17:07:01 +0000 (19:07 +0200)
committerIain Sandoe <iain@sandoe.co.uk>
Mon, 5 May 2025 19:52:03 +0000 (20:52 +0100)
commit5a275b5bebdf7746af590fa57378cd48cb8e679a
tree29546abefc42e8c0b239ba82a1fd30129e6a44e9
parentb2fa7e036e72fa0ed63df602cebd4005b078336e
c++: don't remove labels during coro-early-expand-ifns [PR105104]

In some scenarios, it is possible for the CFG cleanup to cause one of
the labels mentioned in CO_YIELD, which coro-early-expand-ifns intends
to remove, to become part of some statement.  As a result, when that
label is removed, the statement it became part of becomes invalid,
crashing the compiler.

There doesn't appear to be a reason to remove the labels (anymore, at
least), so let's not do that.

PR c++/105104

gcc/ChangeLog:

* coroutine-passes.cc (execute_early_expand_coro_ifns): Don't
remove any labels.

gcc/testsuite/ChangeLog:

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

(cherry picked from commit d9c54e9a036189e8961ec17e118fccf794d7bfab)
gcc/coroutine-passes.cc
gcc/testsuite/g++.dg/coroutines/torture/pr105104.C [new file with mode: 0644]