diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 19:11:32 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-03 19:11:32 +0100 |
commit | 00893e79fc62966067af1a106567db96bd170338 (patch) | |
tree | 52b35cd0b42ca28e62a2ffbecade2e13dd8332cf /tests/nan.h | |
parent | 26112352a774737e1ce5580c93654a26c1e82b39 (diff) |
New upstream version 1.2upstream/1.2
Diffstat (limited to 'tests/nan.h')
-rw-r--r-- | tests/nan.h | 38 |
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 */ |