FAIL: gfortran.dg/edit_real_1.f90 on Darwin8

Dominique Dhumieres dominiq@lps.ens.fr
Fri Jul 20 09:35:00 GMT 2007


I have finally decided to give a shot to OSX 10.4 on my G5 and I do
see the edit_real_1.f90 failure. The culprit is:

  write (s, '(1PE10.3,A)') huge(0d0), "z"

The follwoing reduced code:

! { dg-do run }
! Check real value edit descriptors
! Also checks that rounding is performed correctly
program edit_real_1
  character(len=20) s
  character(len=20) x
  parameter (x = "xxxxxxxxxxxxxxxxxxxx")

  print *, huge(0d0), nearest(huge(0d0), -1.0d0)
  print '(2(1PG30.18))', huge(0d0), nearest(huge(0d0), -1.0d0)
  s = x
  write (s, '(1PG10.3,A)') huge(0d0), "z"
  print *, s
  ! E format, very large number.
  ! Used to overflow with positive scale factor
  s = x
  write (s, '(1PE10.3,A)') huge(0d0), "z"
  print *, s
  ! The actual value is target specific, so just do a basic check
  if ((s(1:1) .eq. "*") .or. (s(7:7) .ne. "+") .or. &
      (s(11:11) .ne. "z")) call abort
end

gives under OSX 10.3:

  1.797693134862316E+308  1.797693134862316E+308
      1.797693134862315708+308      1.797693134862315509+308
  1.798+308z         
  1.798+308z         

while it gives under 10.4:

               +Infinity  1.797693134862316E+308
                     +Infinity      1.797693134862315509+308
  +Infinityz         
  +Infinityz         
Abort

One can argue that huge(0d0) rounded to three digits is +Infinity,
but I think it is a bug to get +Infinity with the 18 digit precision.

Any idea on how to trace the problem?

Dominique

BTW when I said under OSX 10.3, it was not accurate, I meant
gfortran 4.3 compiled under 10.3, but run under 10.4



More information about the Fortran mailing list