[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test-float fails on regular PowerPC, too.
From: |
Bruno Haible |
Subject: |
Re: test-float fails on regular PowerPC, too. |
Date: |
Fri, 30 Sep 2011 03:59:31 +0200 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
Hi,
Andreas Metzler wrote on 2011-09-05:
> > > test-float fails on PowerPC (not PowerPC64), too. This causes
> [...]
> > Does the test failure go away if you change in lib/float.in.h the
> > condition
>
> > (defined _ARCH_PPC || defined _POWER) && defined _AIX
>
> > to
>
> > (defined _ARCH_PPC || defined _POWER || defined __ppc__ || defined
> > __powerpc__)
>
> > and adjust m4/float_h.m4 to set FLOAT_H=float.h and REPLACE_FLOAT_LDBL=1
> > (like it is done for AIX)?
>
> Like I tried in the attached patched? - No did not help.
I got access to a Linux/PowerPC machine now, and verified that
1) the only problem on this platform is with LDBL_MAX; all other math.h
related tests pass.
2) the patch below fixes the test failure.
2011-09-29 Bruno Haible <address@hidden>
float: Fix LDBL_MAX value on Linux/PowerPC.
* m4/float_h.m4 (gl_FLOAT_H): Set FLOAT_H and REPLACE_FLOAT_LDBL also
on Linux/PowerPC.
* lib/float.in.h (LDBL_MAX): Redefine also on Linux/PowerPC.
* lib/float.c (gl_LDBL_MAX): Also define on Linux/PowerPC.
* doc/posix-headers/float.texi: Mention Linux/PowerPC as an affected
platform.
Reported by Andreas Metzler <address@hidden>.
--- doc/posix-headers/float.texi.orig Fri Sep 30 03:52:12 2011
+++ doc/posix-headers/float.texi Fri Sep 30 03:52:05 2011
@@ -14,8 +14,9 @@
@samp{double}.
On FreeBSD/x86 6.4, they represent the incorrect 53-bit precision assumptions
in the compiler, not the real 64-bit precision at runtime.
-On AIX 7.1 with GCC 4.2 and on IRIX 6.5, they don't reflect the
-``double double'' representation of @code{long double} correctly.
+On Linux/PowerPC with GCC 4.4, on AIX 7.1 with GCC 4.2, and on IRIX 6.5,
+they don't reflect the ``double double'' representation of @code{long double}
+correctly.
@end itemize
Portability problems not fixed by Gnulib:
--- lib/float.c.orig Fri Sep 30 03:52:12 2011
+++ lib/float.c Thu Sep 29 23:02:37 2011
@@ -20,7 +20,7 @@
/* Specification. */
#include <float.h>
-#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG ==
106) && defined __GNUC__
+#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined
__linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
const union gl_long_double_union gl_LDBL_MAX =
{ { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } };
#elif defined __i386__
--- lib/float.in.h.orig Fri Sep 30 03:52:12 2011
+++ lib/float.in.h Fri Sep 30 03:50:52 2011
@@ -109,7 +109,8 @@
#endif
/* On AIX 7.1 with gcc 4.2, the values of LDBL_MIN_EXP, LDBL_MIN, LDBL_MAX are
- wrong. */
+ wrong.
+ On Linux/PowerPC with gcc 4.4, the value of LDBL_MAX is wrong. */
#if (defined _ARCH_PPC || defined _POWER) && defined _AIX && (LDBL_MANT_DIG ==
106) && defined __GNUC__
# undef LDBL_MIN_EXP
# define LDBL_MIN_EXP DBL_MIN_EXP
@@ -117,6 +118,8 @@
# define LDBL_MIN_10_EXP DBL_MIN_10_EXP
# undef LDBL_MIN
# define LDBL_MIN 2.22507385850720138309023271733240406422e-308L /* DBL_MIN =
2^-1022 */
+#endif
+#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined
__linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__
# undef LDBL_MAX
/* LDBL_MAX is represented as { 0x7FEFFFFF, 0xFFFFFFFF, 0x7C8FFFFF, 0xFFFFFFFF
}.
It is not easy to define:
--- m4/float_h.m4.orig Fri Sep 30 03:52:12 2011
+++ m4/float_h.m4 Thu Sep 29 22:58:14 2011
@@ -1,4 +1,4 @@
-# float_h.m4 serial 7
+# float_h.m4 serial 8
dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -33,9 +33,16 @@
;;
esac
;;
+ linux*)
+ case "$host_cpu" in
+ powerpc*)
+ FLOAT_H=float.h
+ ;;
+ esac
+ ;;
esac
case "$host_os" in
- aix* | freebsd*)
+ aix* | freebsd* | linux*)
if test -n "$FLOAT_H"; then
REPLACE_FLOAT_LDBL=1
fi
--
In memoriam Cheb Hasni <http://en.wikipedia.org/wiki/Cheb_Hasni>