]> Savannah Git Hosting - gnulib.git/commitdiff
snan: Avoid test failures with CC="gcc -mfpmath=387".
authorBruno Haible <bruno@clisp.org>
Sat, 14 Oct 2023 18:30:50 +0000 (20:30 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 14 Oct 2023 18:30:50 +0000 (20:30 +0200)
* tests/test-snan-1.c (main): Treat x86_64 CPU with
__FLT_EVAL_METHOD__ == 2 like i386 CPU. Update comments.
* tests/test-snan-2.c (main): Likewise.

ChangeLog
tests/test-snan-1.c
tests/test-snan-2.c

index 3abc21c4424dcb44096335aa6577bf8657447515..eb1271eb65de1dc9473bc0111e473a4657ead3b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-10-14  Bruno Haible  <bruno@clisp.org>
+
+       snan: Avoid test failures with CC="gcc -mfpmath=387".
+       * tests/test-snan-1.c (main): Treat x86_64 CPU with
+       __FLT_EVAL_METHOD__ == 2 like i386 CPU. Update comments.
+       * tests/test-snan-2.c (main): Likewise.
+
 2023-10-14  Bruno Haible  <bruno@clisp.org>
 
        snan: Fix the value of SNaNl() on i386, x86_64, ia64 CPUs.
index fc8fc99e312fadbbf9e58f3e325152db4025622c..911d20bd7038e2d30d716f844cc6e022ef29b30a 100644 (file)
@@ -61,15 +61,13 @@ main ()
   long double volatile nanl = SNaNl ();
 
   /* Check that the values are really signalling.  */
-  /* These tests do not work on 32-bit x86 processors, although the
-     "Intel 64 and IA-32 Architectures Software Developer's Manual" and
-     "IA-32 Intel Architecture Software Developer's Manual", each in
-     sections
-       4.8.3.4 NaNs
-       4.8.3.5 Operating on SNaNs and QNaNs
-       4.8.3.6 Using SNaNs and QNaNs in Applications
-     claim that it should work.  */
-  #if !(defined __i386 || defined _M_IX86)
+  /* These tests do not work on 32-bit x86 processors, as well as
+     on x86_64 processors with CC="gcc -mfpmath=387", because loading SNaNf()
+     or SNaNd() into a 387 FPU register already converted it to a quiet NaN.
+     See <https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00060.html>
+     for details.  */
+  #if !((defined __i386 || defined _M_IX86) \
+        || ((defined __x86_64__ || defined _M_X64) && __FLT_EVAL_METHOD__ == 2))
   /* This test does not work on AIX 7.1 with the xlc compiler, even with
      the compiler options -qfloat=fenv -qfloat=nans -qfloat=spnans.  */
   #if !(defined _AIX && defined __xlC__)
index 42927d6077849a6152ba21a765b77404651defdd..4ddd3ac9b13890a6bd595465aa6f44c3f0aee49d 100644 (file)
@@ -65,15 +65,13 @@ main (int argc, char *argv[])
     switch (argv[1][0])
       {
       case 'f':
-        /* This test does not work on 32-bit x86 processors, although the
-           "Intel 64 and IA-32 Architectures Software Developer's Manual" and
-           "IA-32 Intel Architecture Software Developer's Manual", each in
-           sections
-             4.8.3.4 NaNs
-             4.8.3.5 Operating on SNaNs and QNaNs
-             4.8.3.6 Using SNaNs and QNaNs in Applications
-           claim that it should work.  */
-        #if !(defined __i386 || defined _M_IX86)
+        /* This test does not work on 32-bit x86 processors, as well as
+           on x86_64 processors with CC="gcc -mfpmath=387", because loading
+           SNaNf() into a 387 FPU register already converted it to a quiet NaN.
+           See <https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00060.html>
+           for details.  */
+        #if !((defined __i386 || defined _M_IX86) \
+              || ((defined __x86_64__ || defined _M_X64) && __FLT_EVAL_METHOD__ == 2))
         /* This test does not work on AIX 7.1 with the xlc compiler, even with
            the compiler options -qfloat=fenv -qfloat=nans -qfloat=spnans.  */
         #if !(defined _AIX && defined __xlC__)
@@ -89,15 +87,13 @@ main (int argc, char *argv[])
         break;
 
       case 'd':
-        /* This test does not work on 32-bit x86 processors, although the
-           "Intel 64 and IA-32 Architectures Software Developer's Manual" and
-           "IA-32 Intel Architecture Software Developer's Manual", each in
-           sections
-             4.8.3.4 NaNs
-             4.8.3.5 Operating on SNaNs and QNaNs
-             4.8.3.6 Using SNaNs and QNaNs in Applications
-           claim that it should work.  */
-        #if !(defined __i386 || defined _M_IX86)
+        /* This test does not work on 32-bit x86 processors, as well as
+           on x86_64 processors with CC="gcc -mfpmath=387", because loading
+           SNaNd() into a 387 FPU register already converted it to a quiet NaN.
+           See <https://lists.gnu.org/archive/html/bug-gnulib/2023-10/msg00060.html>
+           for details.  */
+        #if !((defined __i386 || defined _M_IX86) \
+              || ((defined __x86_64__ || defined _M_X64) && __FLT_EVAL_METHOD__ == 2))
         resultd = nand + 42.0;
         #else
         fputs ("Skipping test: known failure on this platform\n", stderr);
@@ -125,7 +121,9 @@ main (int argc, char *argv[])
                    || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && (defined __aarch64__ || defined __sparc__))) \
                   && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE) \
               || (defined __CYGWIN__ && defined __i386) \
-              || ((defined __i386 || defined _M_IX86) && HAVE_SAME_LONG_DOUBLE_AS_DOUBLE))
+              || (((defined __i386 || defined _M_IX86) \
+                   || ((defined __x86_64__ || defined _M_X64) && __FLT_EVAL_METHOD__ == 2)) \
+                  && HAVE_SAME_LONG_DOUBLE_AS_DOUBLE))
         resultl = nanl + 42.0L;
         #else
         fputs ("Skipping test: known failure on this platform\n", stderr);