This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/48341] New: LDBL_EPSILON is wrong on IRIX 6.5
- From: "ro at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 29 Mar 2011 17:32:23 +0000
- Subject: [Bug c/48341] New: LDBL_EPSILON is wrong on IRIX 6.5
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48341
Summary: LDBL_EPSILON is wrong on IRIX 6.5
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ro@gcc.gnu.org
Host: mips-sgi-irix6.5
Target: mips-sgi-irix6.5
Build: mips-sgi-irix6.5
When looking at a libstdc++ testsuite failure on IRIX 6.5
FAIL: 18_support/numeric_limits/epsilon.cc execution test
Assertion failed: EX, file
/vol/gcc/src/hg/gcc-4.6-branch/local/libstdc++-v3/testsuite/18_support/numeric_limits/epsilon.cc,
line 37
I found that the testcase aborts checking long double LDBL_EPSILON:
Program received signal SIGABRT, Aborted.
0x0fa4ac28 in _prctl () from /usr/lib32/libc.so.1
(gdb) where
[...]
#5 0x0fa756c4 in __assert () at
/xlv86/patches/7207/work/irix/lib/libc/libc_n32_M4/gen/assert.c:59
#6 0x10002210 in test_epsilon<long double> () at
/vol/gcc/src/hg/trunk/local/libstdc++-v3/testsuite/18_support/numeric_limits/epsilon.cc:37
#7 0x10002108 in main () at
/vol/gcc/src/hg/trunk/local/libstdc++-v3/testsuite/18_support/numeric_limits/epsilon.cc:44
While epsilon is printed as 0 here, in
mips-sgi-irix6.5/libstdc++-v3/include/limits, I find __LDBL_EPSILON__ is
-1.596672247627775849325098170429471e+293
Running the testcase through g++ -g3 -save-temps, epsilon.ii reveals
#define __FLT_EPSILON__ 1.19209289550781250000000000000000e-7F
#define __DBL_EPSILON__ double(2.22044604925031308084726333618164e-16L)
#define __LDBL_EPSILON__ 4.94065645841246544176568792868221e-324L
which is obviously bogus. The native <internal/float_core.h> has
#define FLT_EPSILON 1.19209290E-07F
#define DBL_EPSILON 2.2204460492503131E-16
#define LDBL_EPSILON 1.232595164407830945955825883254353E-32L
IRIX 6 uses the IBM double format for long double. As expected, the
gcc.target/powerpc/rs6000-ldouble-2.c testcase also FAILs.
eps is correctly determined:
(gdb) p eps
$1 = 2.465190328815661891911651766508707e-32
This can be seen with the following test:
$ cat ld.c
#include <stdio.h>
#include <float.h>
int
main (void)
{
printf ("LDBL_EPSILON = %Lg\n", LDBL_EPSILON);
return 0;
}
$ cc -o ld-cc ld.c
$ ./ld-cc
LDBL_EPSILON = 1.2326e-32
$ ./xgcc -B./ -o ld-gcc ld.c
$ ./ld-gcc
LDBL_EPSILON = 4.94066e-324