I don't understand, what bug is this hiding?
This patch addresses two bugs that I know of:
- gcc optimizes some on-stack variables to use SSE vectors, which must be 16-bit aligned; it then assumes that they are 16-bit aligned simply based on their frame offset and uses e.g. movaps to access them (WineHQ bug 55007);
- we use DECLSPEC_ALIGN to specify manually aligned variables on-stack; gcc assumes that since the stack is 16-bit aligned already, it only needs to make sure their frame offset is aligned, which is not the case (encountered in merge request 3504).
In both cases the most correct solution, as far as I can tell, is for gcc to be aware that the stack isn't 16-bit aligned. I don't see a more correct solution; am I missing something?
The bug is in gcc/mingw. The Windows ABI doesn't require the stack to be aligned, so when building a PE binary, gcc/mingw should already know that the stack isn't aligned, it shouldn't need to be told explicitly.
My understanding is that Mingw mostly gets it right, but there are some exotic options like `-march=znver4` that trigger a broken code path. The hope is that the compiler can be fixed, and in the meantime we can tell people to avoid using exotic options. If we simply hide the bug, more of these broken code paths will creep up.
If you mean MSVCRTFLAGS, my understanding was that MSVCRTFLAGS is the flags we use to compile old-style .dll.so's that link to msvcrt (which is all of them, now) in case we're compiling without MinGW. Assuming that's correct, I added this to MSVCRTFLAGS since it seemed correct; i.e. the issue is present there as well (and in fact will continue to be present even if the upstream bug is fixed). I know that compiling without MinGW presents unfixable problems in some cases, but it hasn't been formally deprecated or removed yet, so I assumed that maintaining it wouldn't be the wrong thing to do.
Old-style .dll.so are built with the host compiler, and thus follow the host ABI which assumes that the stack is always 16-byte aligned. That's why we have to use `force_align_arg_pointer`.
It wouldn't make sense to force aligning the stack everywhere and then tell the compiler that the stack isn't aligned.