[Bug libfortran/32841] [4.3 regression] HUGE(1.0d0) output as +Infinity on ppc-darwin8

dominiq at lps dot ens dot fr gcc-bugzilla@gcc.gnu.org
Fri Jul 27 19:34:00 GMT 2007



------- Comment #19 from dominiq at lps dot ens dot fr  2007-07-27 19:34 -------
Subject: Re:  [4.3 regression] HUGE(1.0d0) output as
 +Infinity on ppc-darwin8

> Hum, I don't see anything in rev. 123623
> (http://gcc.gnu.org/viewcvs?view=rev&revision=123623) that looks too
> suspicious. What would need to be done now, in my opinion, is to:
>  1. check that rev. 123622 passes,
>  ...

I cannot say that I am fond of this brute force approach!-(it has to go too far
in the past to look practical). Before that I'ld like to understand what's
going wrong. In the meantime a quick and blind fix is to replace in
libgfortran/libgfortran.h the line

#if defined(HAVE_BROKEN_ISFINITE) || defined(__CYGWIN__)

by

#if defined(HAVE_BROKEN_ISFINITE) || defined(__CYGWIN__) ||
defined(whatever_for_PPC_Darwin)

This fix the failure:

FAIL: gfortran.dg/large_real_kind_2.F90  -O0  execution test
FAIL: gfortran.dg/large_real_kind_2.F90  -O1  execution test
FAIL: gfortran.dg/large_real_kind_2.F90  -O2  execution test
FAIL: gfortran.dg/large_real_kind_2.F90  -O3 -fomit-frame-pointer  execution
test
FAIL: gfortran.dg/large_real_kind_2.F90  -O3 -fomit-frame-pointer
-funroll-loops  execution test
FAIL: gfortran.dg/large_real_kind_2.F90  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/large_real_kind_2.F90  -O3 -g  execution test
FAIL: gfortran.dg/large_real_kind_2.F90  -Os  execution test
FAIL: gfortran.dg/large_real_kind_form_io_2.f90  -O0  execution test
FAIL: gfortran.dg/large_real_kind_form_io_2.f90  -O1  execution test
FAIL: gfortran.dg/large_real_kind_form_io_2.f90  -O2  execution test
FAIL: gfortran.dg/large_real_kind_form_io_2.f90  -O3 -fomit-frame-pointer 
execution test
FAIL: gfortran.dg/large_real_kind_form_io_2.f90  -O3 -fomit-frame-pointer
-funroll-loops  execution test
FAIL: gfortran.dg/large_real_kind_form_io_2.f90  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/large_real_kind_form_io_2.f90  -O3 -g  execution test
FAIL: gfortran.dg/large_real_kind_form_io_2.f90  -Os  execution test
FAIL: gfortran.fortran-torture/compile/pr32417.f90,  "-O"   (internal compiler
error)

                === gfortran Summary for unix/-m32 ===

# of expected passes            19398
# of unexpected failures        17
# of expected failures          9
# of unsupported tests          58

/opt/gcc/darwin_build/gcc/testsuite/gfortran/../../gfortran  version 4.3.0
20070720 (experimental)

Now among the many things I don't understand is the following facts.

(1) the following program:

#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#include <float.h>
int main ()
{
#ifdef isfinite
#ifdef LDBL_MAX
  printf("LDBL_MAX is defined\n");
  if (!isfinite(LDBL_MAX)) printf("bad long double\n");
#endif
#ifdef DBL_MAX
   printf("DBL_MAX is defined\n");
  if (!isfinite(DBL_MAX)) printf("bad double\n");
#endif
  printf("isfinite defined\n");
#endif
printf("end of test\n");
}

gives:

LDBL_MAX is defined
bad long double
DBL_MAX is defined
isfinite defined
end of test

when compiled with gcc version 4.3.0 20070720 and 

LDBL_MAX is defined
DBL_MAX is defined
isfinite defined
end of test

when compiled with gcc version 4.0.1 (Apple Computer, Inc. build 5367)
using gcc?? -DHAVE_MATH_H isfinite_p.c (gcc?? stands for the different
flavors).

By any chance is it possible that libgfortran/configure uses
the system gcc and not xgcc?  In that case that would explain
why the broken isfinite is not detected.

(2) From this it seems that isfinite(DBL_MAX) is working.
Why is it not working when writing HUGE(1.0d0)?
Does the writing use long doubles?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32841



More information about the Gcc-bugs mailing list