]> git.ipfire.org Git - people/ms/gcc.git/commit
c++: top level bind when rewriting coroutines [PR106188]
authorArsen Arsenović <arsen@aarsen.me>
Sun, 4 Sep 2022 19:04:23 +0000 (21:04 +0200)
committerArsen Arsenović <arsen@aarsen.me>
Mon, 13 Mar 2023 21:37:30 +0000 (22:37 +0100)
commit775be7d6cb55173950b62c3b9c11ee208cfff29a
tree03b86de9459e96f4eeb82d1073e050b42bbb39ff
parentbcf467a1dfa7afcde57f4c132d1b666778145c93
c++: top level bind when rewriting coroutines [PR106188]

In the edge case of a coroutine not containing any locals, the ifcd/switch
temporaries would get added to the coroutine frame, corrupting its
layout. To prevent this, we can make sure there is always a BIND_EXPR at
the top of the function body, and thus, always a place for our new
temporaries to go without interfering with the coroutine frame.

PR c++/106188 - Incorrect frame layout after transforming conditional statement without top-level bind expression
PR c++/106713 - if (co_await ...) crashes with a jump to ud2

PR c++/106188
PR c++/106713

gcc/cp/ChangeLog:

* coroutines.cc (coro_rewrite_function_body): Ensure we have a
BIND_EXPR wrapping the function body.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/pr106188.C: New test.
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/pr106188.C [new file with mode: 0644]