Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Win32 version of ThreadImpl::entryPoint and WindowImplWin32::globalOnEvent leave the stack unaligned when compiled with GCC #412
GCC on x86 assumes the stack is 16-byte aligned. In absence of callbacks, this is not an issue, as GCC takes care to pad the stack so that it will be left aligned. However,
Usually it's not a very big problem, because nothing requires 16-byte alignment… unless SSE or AVX is turned on. When it is, the compiler is free to generate a
This is especially problematic with regards to
The solution is to mark these functions, and any other callbacks, should I've missed any, with
Sure. Crashes under Windows 2000 and XP, seems to work under Windows 7 x64, probably because Microsoft made some internal change.
Clang behaves the same way GCC does.
Other compilers assume 4-byte alignment and always emit code that align the stack when they need stronger alignment guarantees, so the problem doesn't occur.
Is there still a need to address this issue?
The fix based on @Fanael's description would be trivial. Simply add a conditional (GCC + clang only)