On 2026/10/19 16:10, LIU Hao wrote:
> 在 2026-10-19 15:36, Zhongteng Gui 写道:
>> Hi, I recently set up a GitHub repo [1] to automatically test builds on all
>> Windows targets (Cygwin, MSYS2, Cygwin-to-MinGW cross, MSYS2-to-MinGW cross,
>> MinGW native) in GitHub Actions. Hopefully, this can make testing GCC patches
>> regarding cygwin / mingw-w64 easier, and ensure patch to one target won't
>> break other Windows targets.
>>
>> I've opened a PR to test your patch [2]. It'd be better if you could provide
>> some simple tests so that we can see whether this patch actually fix the 
>> issue
>> for all Windows targets.
>>
>> [1]: https://github.com/dragon-archer/gcc-for-windows
>> [2]: https://github.com/dragon-archer/gcc-for-windows/pull/6
> 
> Here's a testcase. It only passes on true x86; it won't pass on x86 emulation 
> on ARM64 with default configuration.
> 
> // gcc -mfpmath=387
> 
> #include <assert.h>
> #include <float.h>
> 
> int
> main(void)
>   {
>     static volatile long double l_eps  = 0x0.0000000000000002p0L;  // 2**-63
>     static volatile long double l_1eps = 0x1.0000000000000002p0L;
>     assert(l_1eps != 1);
> 
>     static volatile double d_eps  = 0x0.0000000000001p0;  // 2**-52
>     static volatile double d_1eps = 0x1.0000000000001p0;
>     assert(d_1eps != 1);
> 
>     // default is 64-bit mantissa
>     assert(1 + l_eps == l_1eps);
>     assert(1 + d_eps == d_1eps);
> 
>     // set to 53-bit mantissa
>     _control87(_PC_53, _MCW_PC);
>     assert(1 + l_eps == 1);
>     assert(1 + d_eps == d_1eps);
> 
>     // set to 24-bit mantissa
>     _control87(_PC_24, _MCW_PC);
>     assert(1 + l_eps == 1);
>     assert(1 + d_eps == 1);
> 
>     // restore 64-bit mantissa
>     _control87(_PC_64, _MCW_PC);
>     assert(1 + l_eps == l_1eps);
>     assert(1 + d_eps == d_1eps);
>   }
> 
> 
> 

Thanks, I slightly modified the patch (assisted by GPT 6.1 Sol) [1], and the CI 
suceeds for all
MINGW32, MINGW64, and UCRT64 [2] (See those from msys2-cross, mingw/mingw32 
failed due to an
unrelated error [3]).

I've also ran these tests with existing GCC, and mpc{32,64} failed as expected, 
mpc80 succeeds
as it's the default behavior.

[1]: 
https://github.com/dragon-archer/gcc-for-windows/pull/6/changes/61dafbcf0a50ebda13e4b8ec234f96af744ef39c
[2]: 
https://github.com/dragon-archer/gcc-for-windows/actions/runs/39226854657/job/117975525874
[3]: https://github.com/msys2/msys2-runtime/issues/388

Reply via email to