Commit bd228fec by Jerry DeLisle

re PR libfortran/47434 (Wrong field width for NaN with (F0.n) formatting)

2011-01-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/47434
	* gfortran.dg/read_infnan_1.f90: Update test.
	* gfortran.dg/module_nan.f90: Update test.
	* gfortran.dg/char4_iunit_1.f03: Update test.
	* gfortran.dg/large_real_kind_1.f90: Update test.
	* gfortran.dg/real_const_3.f90: Update test.
	* gfortran.fortran-torture/execute/nan_inf_fmt.f90: Update test.

From-SVN: r169391
parent 6e0576ee
2011-01-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/47434
* gfortran.dg/read_infnan_1.f90: Update test.
* gfortran.dg/module_nan.f90: Update test.
* gfortran.dg/char4_iunit_1.f03: Update test.
* gfortran.dg/large_real_kind_1.f90: Update test.
* gfortran.dg/real_const_3.f90: Update test.
* gfortran.fortran-torture/execute/nan_inf_fmt.f90: Update test.
2011-01-29 Dodji Seketeli <dodji@redhat.com> 2011-01-29 Dodji Seketeli <dodji@redhat.com>
PR c++/47311 PR c++/47311
......
...@@ -26,9 +26,9 @@ program char4_iunit_1 ...@@ -26,9 +26,9 @@ program char4_iunit_1
write(string, *) 1.2345e-06, 4.2846e+10_8 write(string, *) 1.2345e-06, 4.2846e+10_8
if (string .ne. 4_" 1.23450002E-06 42846000000.000000 ") call abort if (string .ne. 4_" 1.23450002E-06 42846000000.000000 ") call abort
write(string, *) nan, inf write(string, *) nan, inf
if (string .ne. 4_" NaN +Infinity ") call abort if (string .ne. 4_" NaN Infinity ") call abort
write(string, '(10x,f3.1,3x,f9.1)') nan, inf write(string, '(10x,f3.1,3x,f9.1)') nan, inf
if (string .ne. 4_" NaN +Infinity ") call abort if (string .ne. 4_" NaN Infinity ") call abort
write(string, *) (1.2, 3.4 ) write(string, *) (1.2, 3.4 )
if (string .ne. 4_" ( 1.2000000 , 3.4000001 ) ") call abort if (string .ne. 4_" ( 1.2000000 , 3.4000001 ) ") call abort
end program char4_iunit_1 end program char4_iunit_1
...@@ -56,7 +56,7 @@ program test ...@@ -56,7 +56,7 @@ program test
call testoutput (-7.51e-100_k,-7.51e-100_8,15,'(F15.10)') call testoutput (-7.51e-100_k,-7.51e-100_8,15,'(F15.10)')
x = huge(x) x = huge(x)
call outputstring (2*x,'(F20.15)',' +Infinity') call outputstring (2*x,'(F20.15)',' Infinity')
call outputstring (-2*x,'(F20.15)',' -Infinity') call outputstring (-2*x,'(F20.15)',' -Infinity')
write (c1,'(G20.10E5)') x write (c1,'(G20.10E5)') x
......
...@@ -19,7 +19,7 @@ program a ...@@ -19,7 +19,7 @@ program a
if (log(abs(inf)) < huge(inf)) call abort() if (log(abs(inf)) < huge(inf)) call abort()
if (log(abs(minf)) < huge(inf)) call abort() if (log(abs(minf)) < huge(inf)) call abort()
if (.not. isnan(nan)) call abort() if (.not. isnan(nan)) call abort()
write(str,*) inf write(str,"(sp,f10.2)") inf
if (adjustl(str) /= "+Infinity") call abort() if (adjustl(str) /= "+Infinity") call abort()
write(str,*) minf write(str,*) minf
if (adjustl(str) /= "-Infinity") call abort() if (adjustl(str) /= "-Infinity") call abort()
......
...@@ -22,9 +22,9 @@ read(10,'(7f10.3)') x4 ...@@ -22,9 +22,9 @@ read(10,'(7f10.3)') x4
rewind(10) rewind(10)
read(10,'(7f10.3)') x8 read(10,'(7f10.3)') x8
write (output, '("x4 =",7G6.0)') x4 write (output, '("x4 =",7G6.0)') x4
if (output.ne."x4 = +Inf NaN +Inf NaN -Inf NaN +Inf") call abort if (output.ne."x4 = Inf NaN Inf NaN -Inf NaN Inf") call abort
write (output, '("x8 =",7G6.0)') x8 write (output, '("x8 =",7G6.0)') x8
if (output.ne."x8 = +Inf NaN +Inf NaN -Inf NaN +Inf") call abort if (output.ne."x8 = Inf NaN Inf NaN -Inf NaN Inf") call abort
!print '("x4 =",7G6.0)', x4 !print '("x4 =",7G6.0)', x4
!print '("x8 =",7G6.0)', x8 !print '("x8 =",7G6.0)', x8
end program pr43298 end program pr43298
......
...@@ -16,7 +16,7 @@ program main ...@@ -16,7 +16,7 @@ program main
b = 1/exp(1000.0) b = 1/exp(1000.0)
write(str,*) a write(str,*) a
if (trim(adjustl(str)) .ne. '+Infinity') call abort if (trim(adjustl(str)) .ne. 'Infinity') call abort
if (b .ne. 0.) call abort if (b .ne. 0.) call abort
...@@ -36,7 +36,7 @@ program main ...@@ -36,7 +36,7 @@ program main
if (trim(adjustl(str)) .ne. '-Infinity') call abort if (trim(adjustl(str)) .ne. '-Infinity') call abort
write(str,*) 3.0/0. write(str,*) 3.0/0.
if (trim(adjustl(str)) .ne. '+Infinity') call abort if (trim(adjustl(str)) .ne. 'Infinity') call abort
write(str,*) nan write(str,*) nan
if (trim(adjustl(str)) .ne. 'NaN') call abort if (trim(adjustl(str)) .ne. 'NaN') call abort
...@@ -48,7 +48,7 @@ program main ...@@ -48,7 +48,7 @@ program main
if (trim(adjustl(str)) .ne. '( NaN, NaN)') call abort if (trim(adjustl(str)) .ne. '( NaN, NaN)') call abort
write(str,*) z3 write(str,*) z3
if (trim(adjustl(str)) .ne. '( +Infinity, -Infinity)') call abort if (trim(adjustl(str)) .ne. '( Infinity, -Infinity)') call abort
write(str,*) z4 write(str,*) z4
if (trim(adjustl(str)) .ne. '( 0.0000000 , -0.0000000 )') call abort if (trim(adjustl(str)) .ne. '( 0.0000000 , -0.0000000 )') call abort
......
!pr 12839- F2003 formatting of Inf /Nan !pr 12839- F2003 formatting of Inf /Nan
! Modified for PR47434
implicit none implicit none
character*40 l character*40 l
character*12 fmt character*12 fmt
...@@ -15,11 +16,11 @@ ...@@ -15,11 +16,11 @@
! check a field width = 0 ! check a field width = 0
fmt = '(F0.0)' fmt = '(F0.0)'
write(l,fmt=fmt)pos_inf write(l,fmt=fmt)pos_inf
if (l.ne.'+Inf') call abort if (l.ne.'Inf') call abort
write(l,fmt=fmt)neg_inf write(l,fmt=fmt)neg_inf
if (l.ne.'-Inf') call abort if (l.ne.'-Inf') call abort
write(l,fmt=fmt)nan write(l,fmt=fmt)nan
if (l.ne.' NaN') call abort if (l.ne.'NaN') call abort
! check a field width < 3 ! check a field width < 3
fmt = '(F2.0)' fmt = '(F2.0)'
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
! check a field width > 3 ! check a field width > 3
fmt = '(F4.0)' fmt = '(F4.0)'
write(l,fmt=fmt)pos_inf write(l,fmt=fmt)pos_inf
if (l.ne.'+Inf') call abort if (l.ne.' Inf') call abort
write(l,fmt=fmt)neg_inf write(l,fmt=fmt)neg_inf
if (l.ne.'-Inf') call abort if (l.ne.'-Inf') call abort
write(l,fmt=fmt)nan write(l,fmt=fmt)nan
...@@ -51,7 +52,7 @@ ...@@ -51,7 +52,7 @@
! check a field width = 7 ! check a field width = 7
fmt = '(F7.0)' fmt = '(F7.0)'
write(l,fmt=fmt)pos_inf write(l,fmt=fmt)pos_inf
if (l.ne.' +Inf') call abort if (l.ne.' Inf') call abort
write(l,fmt=fmt)neg_inf write(l,fmt=fmt)neg_inf
if (l.ne.' -Inf') call abort if (l.ne.' -Inf') call abort
write(l,fmt=fmt)nan write(l,fmt=fmt)nan
...@@ -60,7 +61,7 @@ ...@@ -60,7 +61,7 @@
! check a field width = 8 ! check a field width = 8
fmt = '(F8.0)' fmt = '(F8.0)'
write(l,fmt=fmt)pos_inf write(l,fmt=fmt)pos_inf
if (l.ne.' +Inf') call abort if (l.ne.'Infinity') call abort
write(l,fmt=fmt)neg_inf write(l,fmt=fmt)neg_inf
if (l.ne.' -Inf') call abort if (l.ne.' -Inf') call abort
write(l,fmt=fmt)nan write(l,fmt=fmt)nan
...@@ -69,7 +70,7 @@ ...@@ -69,7 +70,7 @@
! check a field width = 9 ! check a field width = 9
fmt = '(F9.0)' fmt = '(F9.0)'
write(l,fmt=fmt)pos_inf write(l,fmt=fmt)pos_inf
if (l.ne.'+Infinity') call abort if (l.ne.' Infinity') call abort
write(l,fmt=fmt)neg_inf write(l,fmt=fmt)neg_inf
if (l.ne.'-Infinity') call abort if (l.ne.'-Infinity') call abort
write(l,fmt=fmt)nan write(l,fmt=fmt)nan
...@@ -78,7 +79,7 @@ ...@@ -78,7 +79,7 @@
! check a field width = 14 ! check a field width = 14
fmt = '(F14.0)' fmt = '(F14.0)'
write(l,fmt=fmt)pos_inf write(l,fmt=fmt)pos_inf
if (l.ne.' +Infinity') call abort if (l.ne.' Infinity') call abort
write(l,fmt=fmt)neg_inf write(l,fmt=fmt)neg_inf
if (l.ne.' -Infinity') call abort if (l.ne.' -Infinity') call abort
write(l,fmt=fmt)nan write(l,fmt=fmt)nan
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment