On 32-bit mingw I see this test failure:

FAIL: test-expm1
================

../../gltests/test-expm1.h:49: assertion 'y >= - x' failed
FAIL test-expm1.exe (exit status: 3)

The failure disappears when compiling without -O2. This is a hint that,
again, it's an issue w.r.t. the 64-bit 'double' and the internal 80-bit
floating point values of the x86 FPU. Marking some variables or
intermediate values as 'volatile' is the typical workaround, since it
forces the values to memory.

This patch fixes the issue and gets rid of a more ugly workaround.


2023-04-25  Bruno Haible  <br...@clisp.org>

        expm1 tests: Avoid test failure on 32-bit mingw.
        * tests/test-expm1.h (test_function): Mark y as 'volatile'.

diff --git a/tests/test-expm1.h b/tests/test-expm1.h
index 8d2a9b9398..68f3f6be6f 100644
--- a/tests/test-expm1.h
+++ b/tests/test-expm1.h
@@ -35,14 +35,10 @@ test_function (void)
 
     for (i = -1, x = L_(0.5); i >= MIN_EXP; i--, x *= L_(0.5))
       {
-        DOUBLE y;
+        volatile DOUBLE y;
 
         y = EXPM1 (x);
-#ifdef __MINGW32__ /* mingw returns a value that is slightly too small.  */
-        ASSERT (y >= x * (L_(1.0) - L_(1.0) / TWO_MANT_DIG));
-#else
         ASSERT (y >= x);
-#endif
         ASSERT (y < L_(1.5) * x);
 
         y = EXPM1 (- x);




Reply via email to