summaryrefslogtreecommitdiff
path: root/tests/nan.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
commit163a663518f33bab48b28431972e580b366b4d49 (patch)
treef518ffabaca4a0b93f0103d617e803792d3b0b43 /tests/nan.h
parent1b3a8d5ad2ea2f099d514d9dd51ebf926a628076 (diff)
parentdd0000f7e25abe6c28d4329d324fd7fcab54094f (diff)
Merge branch 'release/debian/1.2-1'HEADdebian/1.2-1master
Diffstat (limited to 'tests/nan.h')
-rw-r--r--tests/nan.h38
1 files changed, 25 insertions, 13 deletions
diff --git a/tests/nan.h b/tests/nan.h
index 6a3a239a..d540a0bb 100644
--- a/tests/nan.h
+++ b/tests/nan.h
@@ -1,5 +1,5 @@
-/* Macros for not-a-number.
- Copyright (C) 2007-2022 Free Software Foundation, Inc.
+/* Macros for quiet not-a-number.
+ Copyright (C) 2007-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,6 +14,9 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+#ifndef _GL_NAN_H
+#define _GL_NAN_H
+
/* IBM z/OS supports both hexadecimal and IEEE floating-point formats. The
former does not support NaN and its isnan() implementation returns zero
@@ -26,14 +29,15 @@
/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains.
- PGI 16.10 complains. */
+ PGI 16.10 complains. clang 13 on mips64 does incorrect constant-folding. */
#if (defined __DECC || defined _MSC_VER \
- || (defined __MVS__ && defined __IBMC__) \
- || defined __PGI)
+ || (defined __MVS__ && defined __IBMC__) \
+ || defined __PGI \
+ || defined __mips__)
static float
NaNf ()
{
- static float zero = 0.0f;
+ static float volatile zero = 0.0f;
return zero / zero;
}
#else
@@ -45,14 +49,15 @@ NaNf ()
/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains.
- PGI 16.10 complains. */
+ PGI 16.10 complains. clang 13 on mips64 does incorrect constant-folding. */
#if (defined __DECC || defined _MSC_VER \
- || (defined __MVS__ && defined __IBMC__) \
- || defined __PGI)
+ || (defined __MVS__ && defined __IBMC__) \
+ || defined __PGI \
+ || defined __mips__)
static double
NaNd ()
{
- static double zero = 0.0;
+ static double volatile zero = 0.0;
return zero / zero;
}
#else
@@ -66,20 +71,27 @@ NaNd ()
runtime type conversion.
The Microsoft MSVC 9 compiler chokes on the expression 0.0L / 0.0L.
The IBM XL C compiler on z/OS complains.
- PGI 16.10 complains. */
+ PGI 16.10 complains.
+ Avoid possible incorrect constant-folding on mips. */
#ifdef __sgi
static long double NaNl ()
{
double zero = 0.0;
return zero / zero;
}
-#elif defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI
+#elif (defined _MSC_VER \
+ || (defined __MVS__ && defined __IBMC__) \
+ || defined __PGI \
+ || defined __mips__)
static long double
NaNl ()
{
- static long double zero = 0.0L;
+ static long double volatile zero = 0.0L;
return zero / zero;
}
#else
# define NaNl() (0.0L / 0.0L)
#endif
+
+
+#endif /* _GL_NAN_H */