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

2010-03-12  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: New test.
	* gfortran.dg/read_x_past.f: Update test.

From-SVN: r157405
This commit is contained in:
Jerry DeLisle 2010-03-12 14:36:16 +00:00
parent bcb8daaee9
commit 7e85c2fd2e
4 changed files with 45 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2010-03-12 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: New test.
* gfortran.dg/read_x_past.f: Update test.
2010-03-11 Tobias Burnus <burnus@net-b.de>
PR fortran/43228

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

@ -1,17 +1,28 @@
! { dg-do run { target fd_truncate } }
! { dg-do run }
! { 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)
integer i
open (10)
open (10, status="scratch")
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)
close(10, status="delete")
30 format(1x,a3,1x,a3,1x,a3,1x,a3)
close(10)
end