re PR tree-optimization/85699 (gcc.dg/nextafter-2.c fail)
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 May 2018 07:38:24 +0000 (09:38 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 10 May 2018 07:38:24 +0000 (09:38 +0200)
PR tree-optimization/85699
* gcc.dg/nextafter-1.c (NO_LONG_DOUBLE): Define if not defined.  Use
!NO_LONG_DOUBLE instead of __LDBL_MANT_DIG__ != 106.
* gcc.dg/nextafter-2.c: Include stdlib.h.  For glibc < 2.24 define
NO_LONG_DOUBLE to 1 before including nextafter-1.c.

From-SVN: r260107

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/nextafter-1.c
gcc/testsuite/gcc.dg/nextafter-2.c

index 5bbcd70..b09ce3e 100644 (file)
@@ -1,3 +1,11 @@
+2018-05-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/85699
+       * gcc.dg/nextafter-1.c (NO_LONG_DOUBLE): Define if not defined.  Use
+       !NO_LONG_DOUBLE instead of __LDBL_MANT_DIG__ != 106.
+       * gcc.dg/nextafter-2.c: Include stdlib.h.  For glibc < 2.24 define
+       NO_LONG_DOUBLE to 1 before including nextafter-1.c.
+
 2018-05-10  Eric Botcazou  <ebotcazou@adacore.com>
 
        * g++.dg/tls/pr85400.C: New test.
index c8647ed..a768574 100644 (file)
@@ -20,6 +20,9 @@ long double nexttowardl (long double, long double);
 #ifndef NEED_EXC
 #define NEED_EXC 0
 #endif
+#ifndef NO_LONG_DOUBLE
+#define NO_LONG_DOUBLE (__LDBL_MANT_DIG__ == 106)
+#endif
 
 #define TEST(name, fn, type, L1, L2, l1, l2, MIN1,                          \
             MAX1, DENORM_MIN1, EPSILON1, MIN2, MAX2, DENORM_MIN2)           \
@@ -129,7 +132,7 @@ TEST (test1, nextafterf, float, F, F, f, f, __FLT_MIN__, __FLT_MAX__,
 TEST (test2, nextafter, double, , , , , __DBL_MIN__, __DBL_MAX__,
       __DBL_DENORM_MIN__, __DBL_EPSILON__, __DBL_MIN__, __DBL_MAX__,
       __DBL_DENORM_MIN__)
-#if __LDBL_MANT_DIG__ != 106
+#if !NO_LONG_DOUBLE
 TEST (test3, nextafterl, long double, L, L, l, l, __LDBL_MIN__, __LDBL_MAX__,
       __LDBL_DENORM_MIN__, __LDBL_EPSILON__, __LDBL_MIN__, __LDBL_MAX__,
       __LDBL_DENORM_MIN__)
@@ -149,7 +152,7 @@ main ()
 {
   test1 ();
   test2 ();
-#if __LDBL_MANT_DIG__ != 106
+#if !NO_LONG_DOUBLE
   test3 ();
   test4 ();
   test5 ();
index ef34676..0bde721 100644 (file)
@@ -5,4 +5,13 @@
 /* { dg-add-options ieee } */
 /* { dg-add-options c99_runtime } */
 
+#include <stdlib.h>
+
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+# if !__GLIBC_PREREQ (2, 24)
+/* Workaround buggy nextafterl in glibc 2.23 and earlier,
+   see https://sourceware.org/bugzilla/show_bug.cgi?id=20205  */
+#  define NO_LONG_DOUBLE 1
+# endif
+#endif
 #include "nextafter-1.c"