Bug 97433 - C++20 Coroutines, Unexpected reordering of await_resume, return_value and yield_value
Summary: C++20 Coroutines, Unexpected reordering of await_resume, return_value and yie...
Status: ASSIGNED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Iain Sandoe
URL:
Keywords: C++-coroutines, wrong-code
Depends on:
Blocks:
 
Reported: 2020-10-15 00:27 UTC by David Ledger
Modified: 2022-03-11 00:30 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-10-16 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Ledger 2020-10-15 00:27:54 UTC
Critical components of c++20 coroutines are being reordered. This means that for Task types that return values using co_return and co_yield there is likely incorrect results.

LLVM does not have this issue.
MSVC behaves the same as GCC.

I've outlined this problem in detail here:
https://stackoverflow.com/questions/64348125/c20-coroutines-unexpected-reordering-of-await-resume-return-value-and-yield

The problem can be seen here, but the explaination is in the stack overflow post:
https://godbolt.org/z/7rn5jz

(It let me format the post nicely)
Comment 1 Iain Sandoe 2020-10-16 07:03:52 UTC
probably a dup of 97452.