https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111107
Gabriel Ivăncescu <gabrielopcode at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gabrielopcode at gmail dot com --- Comment #7 from Gabriel Ivăncescu <gabrielopcode at gmail dot com> --- So to re-iterate summary of the problem: 1) The i686 Win32 ABI has a de-facto stack alignment of 4 bytes *only*. GCC may have set it to 16 bytes on Linux because it compiled the whole userland, but that's not the case on Windows; the caller can be MSVC compiled code (very likely on Windows) and MSVC only uses 4-byte alignment. 2) SSE is *not* the only thing that requires stack realignment. Sure, it does require it, but that's more a side effect of requiring larger-than-4 alignment in the first place. A variable (or its type) declared with __attribute__((aligned(...))) **should** also let GCC re-align the stack upon entry, if it's > 4 bytes and if it's actually used on the stack and spilled (or has its address taken). There's no reason to special-case SSE at all. It's just the alignment of the variable or spilled vector that should matter, and GCC must know that the incoming stack is aligned only to 4 bytes on this platform. i686 PE targets should simply default to -mincoming-stack-boundary=2 -mpreferred-stack-boundary=2 (the latter to minimize realignments unless necessary), as that's basically MSVC's behavior, and as such the de-facto standard on this platform.