* [Bug fortran/27561] [mingw32] floating-point extreme values are wrong
2006-05-11 17:18 [Bug fortran/27561] New: i386-pc-mingw32 version incorrect error dir at lanl dot gov
@ 2006-05-30 13:12 ` fxcoudert at gcc dot gnu dot org
2006-05-30 13:17 ` fxcoudert at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-30 13:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from fxcoudert at gcc dot gnu dot org 2006-05-30 13:11 -------
Confirmed, with the same version of compiler. I'm updating to current svn to
see if this changes, but I don't have much hope...
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-05-30 13:11:58
date| |
Summary|i386-pc-mingw32 version |[mingw32] floating-point
|incorrect error |extreme values are wrong
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27561
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/27561] [mingw32] floating-point extreme values are wrong
2006-05-11 17:18 [Bug fortran/27561] New: i386-pc-mingw32 version incorrect error dir at lanl dot gov
2006-05-30 13:12 ` [Bug fortran/27561] [mingw32] floating-point extreme values are wrong fxcoudert at gcc dot gnu dot org
@ 2006-05-30 13:17 ` fxcoudert at gcc dot gnu dot org
2006-05-30 13:59 ` fxcoudert at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-30 13:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from fxcoudert at gcc dot gnu dot org 2006-05-30 13:16 -------
Lots of things are going badly here:
$ cat dale.f90
real(4) :: x4
real(8) :: x8
print *, " ** REAL(KIND=4) tests ** "
write(*,*) digits(x4), maxexponent(x4), minexponent(x4), &
precision(x4), radix(x4), range(x4)
write(*,"(80(G40.20))") epsilon(x4), huge(x4), tiny(x4)
if (epsilon(x4) == 0.0_4) print *, "EPSILON is wrong"
if (tiny(x4) == 0.0_4) print *, "TINY is wrong"
print *, " ** REAL(KIND=8) tests ** "
write(*,*) digits(x8), maxexponent(x8), minexponent(x8), &
precision(x8), radix(x8), range(x8)
write(*,"(80(G40.20))") epsilon(x8), huge(x8), tiny(x8)
if (epsilon(x8) == 0.0_8) print *, "EPSILON is wrong"
if (tiny(x8) == 0.0_8) print *, "TINY is wrong"
end
On i386-linux, we have:
$ gfortran dale.f90 && ./a.out
** REAL(KIND=4) tests **
24 128 -125 6 2 37
0.11920928955078125000E-06
0.34028234663852885981E+39 0.11754943508222875080E-37
** REAL(KIND=8) tests **
53 1024 -1021 15 2 307
0.22204460492503130808E-15
0.17976931348623157081+309 0.22250738585072013831-307
but on i386-mingw32, we get:
** REAL(KIND=4) tests **
24 128 -125 6 2 38
0.0000000000000000000
+Infinity 0.0000000000000000000
EPSILON is wrong
TINY is wrong
** REAL(KIND=8) tests **
53 1024 -1021 15 2 308
0.0000000000000000000
+Infinity 0.0000000000000000000
EPSILON is wrong
TINY is wrong
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27561
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/27561] [mingw32] floating-point extreme values are wrong
2006-05-11 17:18 [Bug fortran/27561] New: i386-pc-mingw32 version incorrect error dir at lanl dot gov
2006-05-30 13:12 ` [Bug fortran/27561] [mingw32] floating-point extreme values are wrong fxcoudert at gcc dot gnu dot org
2006-05-30 13:17 ` fxcoudert at gcc dot gnu dot org
@ 2006-05-30 13:59 ` fxcoudert at gcc dot gnu dot org
2006-05-30 15:06 ` fxcoudert at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-30 13:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from fxcoudert at gcc dot gnu dot org 2006-05-30 13:59 -------
OK, this still happens with current mainline. I also tried a different GMP/MPRF
combination, and it doesn't make it work. I'll be looking into this.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2006-05-30 13:11:58 |2006-05-30 13:59:36
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27561
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/27561] [mingw32] floating-point extreme values are wrong
2006-05-11 17:18 [Bug fortran/27561] New: i386-pc-mingw32 version incorrect error dir at lanl dot gov
` (2 preceding siblings ...)
2006-05-30 13:59 ` fxcoudert at gcc dot gnu dot org
@ 2006-05-30 15:06 ` fxcoudert at gcc dot gnu dot org
2006-05-30 16:34 ` dir at lanl dot gov
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-30 15:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2006-05-30 15:05 -------
OK, I managed to reduce this to a GMP/MPFR bug on i386-pc-mingw32:
$ cat mpfr.c
#include <stdio.h>
#include <gmp.h>
#include <mpfr.h>
int main (void)
{
mpfr_t b;
mpfr_init (b);
mpfr_set_ui (b, 2, GMP_RNDN);
mpfr_out_str (stdout, 10, 0, b, GMP_RNDN);
fputs ("\n", stdout);
mpfr_pow_si (b, b, -23, GMP_RNDN);
mpfr_out_str (stdout, 10, 0, b, GMP_RNDN);
fputs ("\n", stdout);
return 0;
}
$ gcc mpfr.c -I$HOME/local/include -L$HOME/local/lib -lmpfr -lgmp && ./a.exe
2.0000000000000000
0
while it should output (on i386-pc-linux):
$ gcc mpfr.c -lmpfr -lgmp && ./a.out
2.00000000000000
1.19209289550781e-7
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27561
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/27561] [mingw32] floating-point extreme values are wrong
2006-05-11 17:18 [Bug fortran/27561] New: i386-pc-mingw32 version incorrect error dir at lanl dot gov
` (3 preceding siblings ...)
2006-05-30 15:06 ` fxcoudert at gcc dot gnu dot org
@ 2006-05-30 16:34 ` dir at lanl dot gov
2006-05-30 17:01 ` dir at lanl dot gov
2006-05-31 12:54 ` fxcoudert at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: dir at lanl dot gov @ 2006-05-30 16:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dir at lanl dot gov 2006-05-30 16:34 -------
It is strange - gfortran under cygwin does not seem to have the problem. I
wonder why GMP/MPFR is different under MSYS ? I also tried your test under MSYS
on my system and got the same answer (+one digit) that you got under linux -
$ gcc -o mpfr mpfr.c -lmpfr -lgmp
rantad@XP-RANTAD /d/Docume~1/rantad/mydocu~1/tests
$ mpfr
2.000000000000000
1.192092895507812e-7
rantad@XP-RANTAD /d/Docume~1/rantad/mydocu~1/tests
$ gcc --v
Reading specs from d:/MinGW/bin/../lib/gcc/mingw32/3.4.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as
--host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls
--enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry
--disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt
--without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.2 (mingw-special)
rantad@XP-RANTAD /d/Docume~1/rantad/mydocu~1/tests
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27561
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/27561] [mingw32] floating-point extreme values are wrong
2006-05-11 17:18 [Bug fortran/27561] New: i386-pc-mingw32 version incorrect error dir at lanl dot gov
` (4 preceding siblings ...)
2006-05-30 16:34 ` dir at lanl dot gov
@ 2006-05-30 17:01 ` dir at lanl dot gov
2006-05-31 12:54 ` fxcoudert at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: dir at lanl dot gov @ 2006-05-30 17:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from dir at lanl dot gov 2006-05-30 17:01 -------
I also forced it to use the gcc that came with gfortran getting the same
result. I built with mpfr-2.1.2 and gmp-4.1.4 a while ago when I unsucessfully
tried to build gfortran on my PC. I noticed your MSYS version is printing 16
places (on the 2) after the decimal point where mine is printing 15 and linux
is doing 14.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27561
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/27561] [mingw32] floating-point extreme values are wrong
2006-05-11 17:18 [Bug fortran/27561] New: i386-pc-mingw32 version incorrect error dir at lanl dot gov
` (5 preceding siblings ...)
2006-05-30 17:01 ` dir at lanl dot gov
@ 2006-05-31 12:54 ` fxcoudert at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-31 12:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from fxcoudert at gcc dot gnu dot org 2006-05-31 12:53 -------
OK, I got the confirmation that it was a GMP/MPFR miscompilation with mainline
GCC. Downgrading to gcc-3.4.5 gives a working GMP/MPFR combination. I'll upload
new binaries in the next few days.
Longer story: I installed gcc-4.2.0 from 20050406 as my mingw system compiler
by error when I made that package, thus the problem. I'm currently reinstalling
mingw and msys (with newer binutils also), so it will take some time before my
environment is nicely set up again. Then, I'll work on the OpenMP stuff, which
was near completion when all this hell broke loose :)
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27561
^ permalink raw reply [flat|nested] 8+ messages in thread