re PR libfortran/43320 (200.sixtrack fails setup)

2010-03-10  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/43320
	PR libfortran/43265
	* gfortran.dg/read_eof_6.f: New test
	* gfortran.dg/read_x_eof.f90: Update test.
	* gfortran.dg/read_x_past.f: Update test.

From-SVN: r157378
This commit is contained in:
Jerry DeLisle 2010-03-11 02:26:36 +00:00
parent b7137299f1
commit e1061681b9
4 changed files with 42 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2010-03-10 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/43320
PR libfortran/43265
* gfortran.dg/read_eof_6.f: New test
* gfortran.dg/read_x_eof.f90: Update test.
* gfortran.dg/read_x_past.f: Update test.
2010-03-10 Jan Hubicka <jh@suse.cz>
* gcc.dg/compile/pr43288.c: New test.

View File

@ -0,0 +1,7 @@
! { dg-do run }
! PR43320 Missing EOF on read from empty file.
open(8,status='scratch',form='formatted') ! Create empty file
read(8,'(a80)', end=123) ! Reading from an empty file should be an EOF
call abort
123 continue
end

View File

@ -0,0 +1,16 @@
! { dg-do run }
! PR43265 No EOF condition if reading with '(x)' from an empty file
! Test case from the reporter.
program pr43265
implicit none
integer::i
open(23,status="scratch")
write(23,'(a)') "Line 1"
write(23,'(a)') "Line 2"
write(23,'(a)') "Line 3"
rewind(23)
do i=1,10
read(23,'(1x)',end=12)
enddo
12 if (i.ne.4) call abort
end

View File

@ -2,6 +2,7 @@
! { dg-options -w }
! PR 26661 : Test reading X's past file end with no LF or CR.
! PR 26880 : Tests that rewind clears the gfc_unit read_bad flag.
! PR 43265 : Tests that no error occurs with or without X at end.
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
implicit none
character(3) a(4)
@ -10,8 +11,18 @@
10 format(A,$) ! This is not pedantic
write(10,10)' abc def ghi jkl'
rewind(10)
a = ""
read(10,20)(a(i),i=1,4)
if (a(4).ne."jkl") call abort()
rewind(10)
a = ""
read(10,30)(a(i),i=1,4)
if (a(4).ne."jkl") call abort()
20 format(1x,a3,1x,a3,1x,a3,1x,a3,10x)
30 format(1x,a3,1x,a3,1x,a3,1x,a3)
close(10)
end