clang allocates the coroutine promise on the stack although it should put the promise on the heap #56513
Labels
clang:codegen
IR generation bugs: mangling, exceptions, etc.
coroutines
C++20 coroutines
duplicate
Resolved as duplicate
miscompilation
So I opened this issue #56455 but didn't receive any response and I thought this is to due lack of reproducible code that demonstrates the bug and the somewhat strange title so I opened this new issue after had a code to reproduce the problem:
The problem occurs with clang 14.0.6 with max optimizations due to allocating a promise of a coroutine on the stack while the coroutine return object
task
has escaped but clang didn't detect that !The exception allocated on the stack turned to be not a problem but it the Microsoft c++ abi which clang adapts on windows.
The problem is tricky because it only happens when escaping the pointer with a pure virtual noexcept method using the abstract base
code to demonstrate the problem:
on godbolt: https://godbolt.org/z/qTdaMEj5o
code here on github:
The text was updated successfully, but these errors were encountered: