On Sunday 03 May 2026 21:10:25 LIU Hao wrote:
> 在 2026-5-3 21:00, Pali Rohár 写道:
> > I'm not exactly sure.
> >
> > Same check is in other winpthreads code, so I followed pattern and used
> > it in winpthreads tests too, so code in winpthreads is consistent.
>
> GCC 4.2 was released 19 years ago, which is really 'too old'.
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.
> BTW, Clang in GNU mode also identifies itself as GCC 4.2, so the check
> really doesn't do anything. I will try removing those checks, and if that
> passes the CI, I can push these changes.
>
>
> > I know, I have figured it out that it is gcc bug and already found bug
> > reports on internet.
> >
> > Maybe if the workaround with `-mincoming-stack-boundary=2
> > -mpreferred-stack-boundary=2`
> > is working, could we add it to mingw-w64 CFLAGS when compiling with
> > gcc-pre-15 and force_align_arg_pointer would not be needed to have it on
> > every place in mingw-w64 source code?
>
> It is still required that every user compile their code with
> `-mincoming-stack-boundary=2 -mpreferred-stack-boundary=2`. As the issue has
> been fixed in GCC 16, there's likely no point in adding it any more.
User callback code still need to use force_align_arg_pointer (or
whatever will fix ESP for SSE2).
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.
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public