+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.
#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) \
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__)
{
test1 ();
test2 ();
-#if __LDBL_MANT_DIG__ != 106
+#if !NO_LONG_DOUBLE
test3 ();
test4 ();
test5 ();
/* { 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"