https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118399
Bug ID: 118399
Summary: [coroutine] Stack misaligned
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: newsigma at 163 dot com
Target Milestone: ---
Compiler explorer: https://godbolt.org/z/7d3aPnvrM
GCC version: 10 ~ trunk
Build option: -mavx -std=c++20
```
#include <immintrin.h>
#include <coroutine>
struct coro {
using promise_type = coro;
coro get_return_object() noexcept { return {}; }
std::suspend_never initial_suspend() noexcept { return {}; }
std::suspend_always final_suspend() noexcept { return {}; }
void return_void() noexcept {}
void unhandled_exception() {}
};
coro f() {
__m256d ymm{};
co_return;
}
int main() {
f();
return 0;
}
```
At line 4012c9:
```
```
vmovapd %ymm0,0x40(%rax)
```
0x40(%avx) is not properly aligned as 32.
LLVM has a similar issue that read from a misaligned position, while gcc try to
write to a misaligned position.
FYI: https://github.com/llvm/llvm-project/issues/122283