在 2026-5-3 21:19, Pali Rohár 写道:
I still have installed gcc 4.2.1 which I sometimes use for verification. I could try to compile current mingw-w64 what would happen.But those checks are for pre-4.2 versions, so I cannot check what happens with that winpthread code.
The CRT itself has not been checking for GCC 4.2 since 8 years ago, when the attribute was added: 6045a1edf7ac224675831d088ab4cb8086b15ea8
User callback code still need to use force_align_arg_pointer (or whatever will fix ESP for SSE2).
It's because `-mincoming-stack-boundary=` was mistakenly set to 4 (16 bytes) for i686, so code that was compiled by GCC 15- assumed its caller had aligned ESP, which was not true if it was called from code by MSVC.
In GCC 16 it's set to 2 (4 bytes), so user code needs no modification. When SSE is used in a function, ESP will be realigned automatically.
gcc documentation says:
-mincoming-stack-boundary=num
Assume the incoming stack is aligned to a 2 raised to num byte
boundary. If -mincoming-stack-boundary is not specified, the one
specified by -mpreferred-stack-boundary is used.
(I did not know about this gcc flag before)
So could not we achieve same effect of the force_align_arg_pointer by
compiling the whole mingw-w64 (only when pre-16 gcc is detected e.g. in
./configure phase) with just the -mincoming-stack-boundary=2 flag? And
then we could remove those force_align_arg_pointer from all mingw-w64
places. It does not fix user code, but at least cleanup a little
mingw-w64 code and moreover nobody would need to think if the function
has to be marked by attribute force_align_arg_pointer manually or not.
I'm afraid this could cause faults again if someone compiles their code with GCC 16 and links against an old lib which was compiled with GCC 15-; maybe such library will eventually require rebuilding. I don't recommend that we delete it now.
-- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
