[Bug libfortran/24685] real(16) formatted input is broken for huge values
fxcoudert at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed May 24 18:58:00 GMT 2006
------- Comment #19 from fxcoudert at gcc dot gnu dot org 2006-05-24 18:58 -------
(In reply to comment #18)
> it is still broken on powerpc{,64}
Hi Jakub, I'm not sure exactly what is still broken. On
powerpc-apple-darwin7.9.0, with mainline gfortran 20060512:
$ cat foo.f90
! { dg-do run }
! { dg-require-effective-target fortran_large_real }
program huge_real10_formatted
! This should be kind=10 on systems that support it
integer, parameter :: k = selected_real_kind (precision (0.0_8) + 1)
real(kind=k) :: a,b(2), c
character(len=180) :: tmp
! Test real(k) scalar and array formatted IO with big value
b(:) = huge (1.0_k)/2
print *, 'real(10) big value: ', b(1)
write (tmp, *) b
read (tmp, *) a, c
print *, 'same value read again: ', a
print *, 'difference: ', a-b(1)
! Test with really big value
b(:) = huge (1.0_k)
print *, 'huge value: ', b(1)
write (tmp, *) b
read (tmp, *) a, c ! This is line 19
print *, "We don't get this far!"
if (a /= b(1)) call abort ()
if (c /= b(2)) call abort ()
end program huge_real10_formatted
$ gfortran foo.f90 && ./a.out
real(10) big value: 4.4942328371557897693232629769725618E+0307
same value read again: 4.4942328371557897693232629769725618E+0307
difference: 0.000000000000000000000000000000000
huge value: 8.9884656743115795386465259539451237E+0307
We don't get this far!
$ gfortran foo.f90 -mlong-double-128 && ./a.out
real(10) big value: 4.4942328371557897693232629769725618E+0307
same value read again: 4.4942328371557897693232629769725618E+0307
difference: 0.000000000000000000000000000000000
huge value: 8.9884656743115795386465259539451237E+0307
We don't get this far!
$ cat real16.f90
character(len=100) :: a
real(kind=16) :: x, y, z
x = huge(x)
write(a,*) x
read(a,*) y
if (x /= y) print *, x, y, x-y
end
$ gfortran real16.f90 && ./a.out
$ gfortran real16.f90 -mlong-double-128 && ./a.out
All this looks like it's working fine...
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu dot org
AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
More information about the Gcc-bugs
mailing list