在 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);
  }



--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to