changeset 10656:2d3e9948c077

Avoid compilation error due to MacOS X 10.5 gcc cross-compilation bug.
author Bruno Haible <bruno@clisp.org>
date Sat, 18 Oct 2008 03:15:17 +0200
parents 8668b19a7032
children ab877c995f41
files ChangeLog m4/signbit.m4 tests/test-ceill.c tests/test-floorl.c tests/test-frexpl.c tests/test-isnan.c tests/test-isnanl.h tests/test-ldexpl.c tests/test-roundl.c tests/test-signbit.c tests/test-snprintf-posix.h tests/test-sprintf-posix.h tests/test-truncl.c tests/test-vasnprintf-posix.c tests/test-vasprintf-posix.c
diffstat 15 files changed, 115 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2008-10-17  Bruno Haible  <bruno@clisp.org>
+
+	* m4/signbit.m4 (gl_SIGNBIT_TEST_PROGRAM): On platforms other than
+	HP-UX and IRIX, use -0.0L.
+	* tests/test-ceill.c (minus_zero): Likewise.
+	* tests/test-floorl.c (minus_zero): Likewise.
+	* tests/test-frexpl.c (minus_zero): Likewise.
+	* tests/test-isnan.c (minus_zerol): Likewise.
+	* tests/test-isnanl.h (minus_zero): Likewise.
+	* tests/test-ldexpl.c (minus_zero): Likewise.
+	* tests/test-roundl.c (minus_zero): Likewise.
+	* tests/test-signbit.c (minus_zerol): Likewise.
+	* tests/test-snprintf-posix.h (minus_zerol): Likewise.
+	* tests/test-sprintf-posix.h (minus_zerol): Likewise.
+	* tests/test-truncl.c (minus_zero): Likewise.
+	* tests/test-vasnprintf-posix.c (minus_zerol): Likewise.
+	* tests/test-vasprintf-posix.c (minus_zerol): Likewise.
+	Reported by Markus Armbruster <armbru@redhat.com> via Jim Meyering
+	and by Nelson H. F. Beebe <beebe@math.utah.edu> via Eric Blake.
+
 2008-10-17  Bruno Haible  <bruno@clisp.org>
 
 	Avoid gcc warnings because of #pragma GCC system_header on older gcc.
--- a/m4/signbit.m4
+++ b/m4/signbit.m4
@@ -131,9 +131,11 @@
 double p0d = 0.0;
 double m0d = -p0d;
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use another constant expression instead.  */
+   So we use another constant expression instead.
+   But that expression does not work on other platforms, such as when
+   cross-compiling to PowerPC on MacOS X 10.5.  */
 long double p0l = 0.0L;
-#ifdef __hpux
+#if defined __hpux || defined __sgi
 long double m0l = -LDBL_MIN * LDBL_MIN;
 #else
 long double m0l = -p0l;
--- a/tests/test-ceill.c
+++ b/tests/test-ceill.c
@@ -40,8 +40,14 @@
   while (0)
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zero instead.  */
+   So we use minus_zero instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zero = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zero = -0.0L;
+#endif
 
 int
 main ()
--- a/tests/test-floorl.c
+++ b/tests/test-floorl.c
@@ -40,8 +40,14 @@
   while (0)
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zero instead.  */
+   So we use minus_zero instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zero = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zero = -0.0L;
+#endif
 
 int
 main ()
--- a/tests/test-frexpl.c
+++ b/tests/test-frexpl.c
@@ -58,8 +58,14 @@
 #endif
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zero instead.  */
+   So we use minus_zero instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zero = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zero = -0.0L;
+#endif
 
 static long double
 my_ldexp (long double x, int d)
--- a/tests/test-isnan.c
+++ b/tests/test-isnan.c
@@ -49,8 +49,14 @@
 double zerod = 0.0;
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zerol instead.  */
+   So we use minus_zerol instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zerol = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zerol = -0.0L;
+#endif
 
 static void
 test_float (void)
--- a/tests/test-isnanl.h
+++ b/tests/test-isnanl.h
@@ -34,8 +34,14 @@
   while (0)
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zero instead.  */
+   So we use minus_zero instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zero = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zero = -0.0L;
+#endif
 
 int
 main ()
--- a/tests/test-ldexpl.c
+++ b/tests/test-ldexpl.c
@@ -40,8 +40,14 @@
   while (0)
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zero instead.  */
+   So we use minus_zero instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zero = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zero = -0.0L;
+#endif
 
 int
 main ()
--- a/tests/test-roundl.c
+++ b/tests/test-roundl.c
@@ -42,8 +42,14 @@
   while (0)
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zero instead.  */
+   So we use minus_zero instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zero = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zero = -0.0L;
+#endif
 
 int
 main ()
--- a/tests/test-signbit.c
+++ b/tests/test-signbit.c
@@ -48,8 +48,14 @@
    So we use -zerod instead.  */
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zerol instead.  */
+   So we use minus_zerol instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zerol = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zerol = -0.0L;
+#endif
 
 static void
 test_signbitf ()
--- a/tests/test-snprintf-posix.h
+++ b/tests/test-snprintf-posix.h
@@ -32,8 +32,14 @@
 double zerod = 0.0;
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zerol instead.  */
+   So we use minus_zerol instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zerol = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zerol = -0.0L;
+#endif
 
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
    of 'unsigned int' words.  */
--- a/tests/test-sprintf-posix.h
+++ b/tests/test-sprintf-posix.h
@@ -32,8 +32,14 @@
 double zerod = 0.0;
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zerol instead.  */
+   So we use minus_zerol instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zerol = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zerol = -0.0L;
+#endif
 
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
    of 'unsigned int' words.  */
--- a/tests/test-truncl.c
+++ b/tests/test-truncl.c
@@ -40,8 +40,14 @@
   while (0)
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zero instead.  */
+   So we use minus_zero instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zero = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zero = -0.0L;
+#endif
 
 int
 main ()
--- a/tests/test-vasnprintf-posix.c
+++ b/tests/test-vasnprintf-posix.c
@@ -57,8 +57,14 @@
 double zerod = 0.0;
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zerol instead.  */
+   So we use minus_zerol instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zerol = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zerol = -0.0L;
+#endif
 
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
    of 'unsigned int' words.  */
--- a/tests/test-vasprintf-posix.c
+++ b/tests/test-vasprintf-posix.c
@@ -57,8 +57,14 @@
 double zerod = 0.0;
 
 /* On HP-UX 10.20, negating 0.0L does not yield -0.0L.
-   So we use minus_zerol instead.  */
+   So we use minus_zerol instead.
+   Note that the expression -LDBL_MIN * LDBL_MIN does not work on other
+   platforms, such as when cross-compiling to PowerPC on MacOS X 10.5.  */
+#if defined __hpux || defined __sgi
 long double minus_zerol = -LDBL_MIN * LDBL_MIN;
+#else
+long double minus_zerol = -0.0L;
+#endif
 
 /* Representation of an 80-bit 'long double' as an initializer for a sequence
    of 'unsigned int' words.  */