2009-02-26 Eric Blake <ebb9@byu.net>
- Bruno Haible <bruno@clisp.org>
+
+ avoid gcc 3.4.3 bug on long double NaN on Irix 6.5
+ * tests/nan.h (NaNl): Rewrite as function on Irix, to avoid
+ compilation bug by using runtime conversion.
+ * m4/isfinite.m4 (gl_ISFINITE): Likewise.
+ * m4/isnanl.m4 (gl_FUNC_ISNANL): Likewise.
+ * modules/ceill-tests (Files): Use nan.h.
+ * modules/floorl-tests (Files): Likewise.
+ * modules/frexpl-tests (Files): Likewise.
+ * modules/isnanl-tests (Files): Likewise.
+ * modules/ldexpl-tests (Files): Likewise.
+ * modules/roundl-tests (Files): Likewise.
+ * modules/truncl-tests (Files): Likewise.
+ * tests/test-ceill.c (main): Use a working NaN.
+ * tests/test-floorl.c (main): Likewise.
+ * tests/test-frexpl.c (main): Likewise.
+ * tests/test-isnan.c (test_long_double): Likewise.
+ * tests/test-isnanl.h (main): Likewise.
+ * tests/test-ldexpl.h (main): Likewise.
+ * tests/test-roundl.h (main): Likewise.
+ * tests/test-truncl.h (main): Likewise.
+ See http://lists.gnu.org/archive/html/bug-gnulib/2009-02/msg00190.html.
+
+2009-02-26 Eric Blake <ebb9@byu.net>
+ Bruno Haible <bruno@clisp.org>
Work around a *printf bug with %ls on Solaris.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_LS): Also test whether, when a
-# isfinite.m4 serial 4
+# isfinite.m4 serial 5
dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { unsigned int word[NWORDS]; long double value; }
memory_long_double;
+/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
+ runtime type conversion. */
+#ifdef __sgi
+static long double NaNl ()
+{
+ double zero = 0.0;
+ return zero / zero;
+}
+#else
+# define NaNl() (0.0L / 0.0L)
+#endif
int main ()
{
memory_long_double m;
in the mantissa bits. The xor operation twiddles a bit that can only be
a sign bit or a mantissa bit (since the exponent never extends to
bit 31). */
- m.value = 0.0L / 0.0L;
+ m.value = NaNl ();
m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
for (i = 0; i < NWORDS; i++)
m.word[i] |= 1;
-# isnanl.m4 serial 11
+# isnanl.m4 serial 12
dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { unsigned int word[NWORDS]; long double value; }
memory_long_double;
+/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
+ runtime type conversion. */
+#ifdef __sgi
+static long double NaNl ()
+{
+ double zero = 0.0;
+ return zero / zero;
+}
+#else
+# define NaNl() (0.0L / 0.0L)
+#endif
int main ()
{
memory_long_double m;
unsigned int i;
- /* gcc-3.4.3 on IRIX 6.5 appears to have a problem with this. */
- if (!isnanl (0.0L / 0.0L))
+ if (!isnanl (NaNl ()))
return 1;
/* The isnanl function should be immune against changes in the sign bit and
in the mantissa bits. The xor operation twiddles a bit that can only be
a sign bit or a mantissa bit (since the exponent never extends to
bit 31). */
- m.value = 0.0L / 0.0L;
+ m.value = NaNl ();
m.word[NWORDS / 2] ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 1);
for (i = 0; i < NWORDS; i++)
m.word[i] |= 1;
Files:
tests/test-ceill.c
+tests/nan.h
Depends-on:
fpucw
Files:
tests/test-floorl.c
+tests/nan.h
Depends-on:
fpucw
Files:
tests/test-frexpl.c
+tests/nan.h
Depends-on:
fpucw
Files:
tests/test-isnanl.c
tests/test-isnanl.h
+tests/nan.h
Depends-on:
float
Files:
tests/test-ldexpl.c
+tests/nan.h
Depends-on:
fpucw
Files:
tests/test-roundl.c
+tests/nan.h
Depends-on:
fpucw
Files:
tests/test-truncl.c
+tests/nan.h
Depends-on:
fpucw
/* Macros for not-a-number.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 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
/* NaNl () returns a 'long double' not-a-number. */
-#define NaNl() (0.0L / 0.0L)
+/* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
+ runtime type conversion. */
+#ifdef __sgi
+static long double NaNl ()
+{
+ double zero = 0.0;
+ return zero / zero;
+}
+#else
+# define NaNl() (0.0L / 0.0L)
+#endif
#include "fpucw.h"
#include "isnanl-nolibm.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
ASSERT (ceill (1.0L / 0.0L) == 1.0L / 0.0L);
ASSERT (ceill (-1.0L / 0.0L) == -1.0L / 0.0L);
/* NaNs. */
- ASSERT (isnanl (ceill (0.0L / 0.0L)));
+ ASSERT (isnanl (ceill (NaNl ())));
return 0;
}
#include "fpucw.h"
#include "isnanl-nolibm.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
ASSERT (floorl (1.0L / 0.0L) == 1.0L / 0.0L);
ASSERT (floorl (-1.0L / 0.0L) == -1.0L / 0.0L);
/* NaNs. */
- ASSERT (isnanl (floorl (0.0L / 0.0L)));
+ ASSERT (isnanl (floorl (NaNl ())));
return 0;
}
#include "fpucw.h"
#include "isnanl-nolibm.h"
+#include "nan.h"
/* Avoid some warnings from "gcc -Wshadow".
This file doesn't use the exp() function. */
{ /* NaN. */
int exp = -9999;
long double mantissa;
- x = 0.0L / 0.0L;
+ x = NaNl ();
mantissa = frexpl (x, &exp);
ASSERT (isnanl (mantissa));
}
ASSERT (!isnan (1.0L / 0.0L));
ASSERT (!isnan (-1.0L / 0.0L));
/* Quiet NaN. */
- ASSERT (isnan (0.0L / 0.0L));
+ ASSERT (isnan (NaNl ()));
#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
/* A bit pattern that is different from a Quiet NaN. With a bit of luck,
it's a Signalling NaN. */
{
memory_long_double m;
- m.value = 0.0L / 0.0L;
+ m.value = NaNl ();
# if LDBL_EXPBIT0_BIT > 0
m.word[LDBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (LDBL_EXPBIT0_BIT - 1);
# else
#include <stdio.h>
#include <stdlib.h>
+#include "nan.h"
+
#define ASSERT(expr) \
do \
{ \
ASSERT (!isnanl (1.0L / 0.0L));
ASSERT (!isnanl (-1.0L / 0.0L));
/* Quiet NaN. */
- ASSERT (isnanl (0.0L / 0.0L));
+ ASSERT (isnanl (NaNl ()));
#if defined LDBL_EXPBIT0_WORD && defined LDBL_EXPBIT0_BIT
/* A bit pattern that is different from a Quiet NaN. With a bit of luck,
it's a Signalling NaN. */
{
memory_long_double m;
- m.value = 0.0L / 0.0L;
+ m.value = NaNl ();
# if LDBL_EXPBIT0_BIT > 0
m.word[LDBL_EXPBIT0_WORD] ^= (unsigned int) 1 << (LDBL_EXPBIT0_BIT - 1);
# else
#include "fpucw.h"
#include "isnanl-nolibm.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
BEGIN_LONG_DOUBLE_ROUNDING ();
{ /* NaN. */
- x = 0.0L / 0.0L;
+ x = NaNl ();
y = ldexpl (x, 0); ASSERT (isnanl (y));
y = ldexpl (x, 5); ASSERT (isnanl (y));
y = ldexpl (x, -5); ASSERT (isnanl (y));
#include "fpucw.h"
#include "isnanl-nolibm.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
ASSERT (roundl (1.0 / 0.0L) == 1.0 / 0.0L);
ASSERT (roundl (-1.0 / 0.0L) == -1.0 / 0.0L);
/* NaNs. */
- ASSERT (isnanl (roundl (0.0L / 0.0L)));
+ ASSERT (isnanl (roundl (NaNl ())));
return 0;
}
#include "fpucw.h"
#include "isnanl-nolibm.h"
+#include "nan.h"
#define ASSERT(expr) \
do \
ASSERT (truncl (1.0L / 0.0L) == 1.0L / 0.0L);
ASSERT (truncl (-1.0L / 0.0L) == -1.0L / 0.0L);
/* NaNs. */
- ASSERT (isnanl (truncl (0.0L / 0.0L)));
+ ASSERT (isnanl (truncl (NaNl ())));
return 0;
}