aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ginclude/float.h4
-rw-r--r--gcc/testsuite/gcc.dg/c2x-float-11.c9
-rw-r--r--gcc/testsuite/gcc.dg/c2x-float-2.c4
3 files changed, 14 insertions, 3 deletions
diff --git a/gcc/ginclude/float.h b/gcc/ginclude/float.h
index 9d368c4..afe4a71 100644
--- a/gcc/ginclude/float.h
+++ b/gcc/ginclude/float.h
@@ -257,9 +257,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define DBL_IS_IEC_60559 __DBL_IS_IEC_60559__
#define LDBL_IS_IEC_60559 __LDBL_IS_IEC_60559__
-/* Infinity in type float, or overflow if infinity not supported. */
+/* Infinity in type float; not defined if infinity not supported. */
+#if __FLT_HAS_INFINITY__
#undef INFINITY
#define INFINITY (__builtin_inff ())
+#endif
/* Quiet NaN, if supported for float. */
#if __FLT_HAS_QUIET_NAN__
diff --git a/gcc/testsuite/gcc.dg/c2x-float-11.c b/gcc/testsuite/gcc.dg/c2x-float-11.c
new file mode 100644
index 0000000..0e2f3c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c2x-float-11.c
@@ -0,0 +1,9 @@
+/* Test INFINITY macro. Test when infinities not supported. */
+/* { dg-do compile { target { ! inff } } } */
+/* { dg-options "-std=c2x" } */
+
+#include <float.h>
+
+#ifdef INFINITY
+#error "INFINITY defined"
+#endif
diff --git a/gcc/testsuite/gcc.dg/c2x-float-2.c b/gcc/testsuite/gcc.dg/c2x-float-2.c
index 4f669fd..61a77f6 100644
--- a/gcc/testsuite/gcc.dg/c2x-float-2.c
+++ b/gcc/testsuite/gcc.dg/c2x-float-2.c
@@ -1,8 +1,8 @@
-/* Test INFINITY macro. Generic test even if infinities not
- supported. */
+/* Test INFINITY macro. Generic test. */
/* { dg-do run } */
/* { dg-options "-std=c2x -w" } */
/* { dg-add-options ieee } */
+/* { dg-require-effective-target inff } */
#include <float.h>