+2023-11-06 Bruno Haible <bruno@clisp.org>
+
+ nan: Work around clang's incorrect constant-folding on mips64.
+ * lib/nan.h (NaNf, NaNd, NaNl): On mips platforms, avoid the compiler's
+ constant-folding for 0.0f/0.0f, 0.0/0.0, 0.0L/0.0L.
+
2023-11-06 Bruno Haible <bruno@clisp.org>
snan: Add more info for mips-based platforms.
/* 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 ()
{
/* 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 ()
{
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 ()
{