This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/33225] New: [4.3 regression] Missing last digit is some formatted output
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Aug 2007 09:58:13 -0000
- Subject: [Bug libfortran/33225] New: [4.3 regression] Missing last digit is some formatted output
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
With the patch in http://gcc.gnu.org/ml/fortran/2007-08/msg00476.html (revision
127846), some formatted output are missing the last digit on Darwin (see
http://gcc.gnu.org/ml/fortran/2007-08/msg00586.html):
! { dg-do run }
! PR32554 Bug in P formatting
! Test case from the bug reporter
program gfcbug66
real(8) :: x = 1.0e-100_8
character(50) :: outstr
write (outstr,'(1X,2E12.3)') x, 2 * x
print *, outstr
if (outstr.ne." 0.100E-99 0.200E-99") call abort
! Before patch 2 * x was put out wrong
write (outstr,'(1X,1P,2E12.3)') x, 2 * x
print *, outstr
if (outstr.ne." 1.000-100 2.000-100") call abort
end program gfcbug66
output
0.100E-99 0.200E-99
1.000-10 2.000-10
Abort
instead of
0.100E-99 0.200E-99
1.000-100 2.000-100
and
! { dg-do run }
! { dg-require-effective-target fortran_large_real }
! PR 24174 and PR 24305
program large_real_kind_form_io_1
! This should be 10 on systems that support kind=10
integer, parameter :: k = selected_real_kind (precision (0.0_8) + 1)
real(kind=k) :: a,b(2), c, eps
complex(kind=k) :: d, e, f(2), g
character(len=180) :: tmp
! Test real(k) scalar and array formatted IO
eps = 10 * spacing (2.0_k) ! 10 ulp precision is enough.
d = cmplx ( 1.0_k, 2.0_k, k)
write (tmp, '(2(e12.4e5, 2x))') d
print *, tmp
read (tmp, '(2(e12.4e5, 2x))') e
if (abs (e - d) > eps) call abort()
end program large_real_kind_form_io_1
outputs
.1000E+0000 .2000E+0000
At line 15 of file large_real_kind_form_io_1_red.f90
Fortran runtime error: Bad value during floating point read
instead of
.1000E+00001 .2000E+00001
Also the code
print *, huge(1.0), -huge(1.0), huge(1.0d0), -huge(1.0d0)
print *, nearest(huge(1.0),-1.0), nearest(-huge(1.0),1.0),
nearest(huge(1.0d0),-1.0d0), nearest(-huge(1.0d0),1.0d0)
print *, nearest(huge(1.0),1.0), nearest(-huge(1.0),-1.0),
nearest(huge(1.0d0),1.0d0), nearest(-huge(1.0d0),-1.0d0)
end
gives
edit_real_1_red_3.f90:3.18:
print *, nearest(huge(1.0),1.0), nearest(-huge(1.0),-1.0), nearest(huge(1.0d0)
1
Error: Result of NEAREST overflows its kind at (1)
edit_real_1_red_3.f90:3.42:
print *, nearest(huge(1.0),1.0), nearest(-huge(1.0),-1.0), nearest(huge(1.0d0)
1
Error: Result of NEAREST overflows its kind at (1)
edit_real_1_red_3.f90:3.68:
print *, nearest(huge(1.0),1.0), nearest(-huge(1.0),-1.0), nearest(huge(1.0d0)
1
Error: Result of NEAREST overflows its kind at (1)
edit_real_1_red_3.f90:3.96:
e(1.0),1.0), nearest(-huge(1.0),-1.0), nearest(huge(1.0d0),1.0d0), nearest(-hug
1
Error: Result of NEAREST overflows its kind at (1)
I was expecting no errors and
3.4028235E+38 -3.4028235E+38 1.7976931348623157E+308 -1.7976931348623157E+308
3.4028233E+38 -3.4028233E+38 1.7976931348623155E+308 -1.7976931348623155E+308
+Inf -Inf +Inf -Inf
If I remove the offending line, the output is:
3.4028235E+38 -3.4028235E+38 1.797693134862316E+30 -1.797693134862316E+30
3.4028233E+38 -3.4028233E+38 1.797693134862316E+30 -1.797693134862316E+30
Due to this regression, the tests gfortran.dg/fmt_p_1.f90,
gfortran.dg/output_exponents_1.f90, and
gfortran.dg/large_real_kind_form_io_1.f90 fail on PPC Darwin.
--
Summary: [4.3 regression] Missing last digit is some formatted
output
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dominiq at lps dot ens dot fr
GCC target triplet: powerpc-apple-darwin8
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33225