mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-13 13:10:56 +08:00
re PR fortran/43265 (No EOF condition if reading with '(x)' from an empty file)
2010-03-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/43265 * gfortran.dg/read_eof_8.f90: New test. From-SVN: r157811
This commit is contained in:
parent
6c1400dd58
commit
63fd825549
gcc/testsuite
@ -1,3 +1,8 @@
|
||||
2010-03-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR libfortran/43265
|
||||
* gfortran.dg/read_eof_8.f90: New test.
|
||||
|
||||
2010-03-29 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* gcc.dg/cpp/include6.c: Change [] to ().
|
||||
|
26
gcc/testsuite/gfortran.dg/read_eof_8.f90
Normal file
26
gcc/testsuite/gfortran.dg/read_eof_8.f90
Normal file
@ -0,0 +1,26 @@
|
||||
! { dg-do run }
|
||||
! PR43265: See comment #26 in the PR. Before patch,
|
||||
! the test case would fail to read the last line of the file.
|
||||
! Thanks to Jean-Baptiste Faure for providing the initial test case.
|
||||
program test
|
||||
character (len=6) :: line
|
||||
integer :: n, k=0
|
||||
open(unit=25,file="test.dat",status="replace", &
|
||||
& form="unformatted", access="stream")
|
||||
write(25) "Line 1" // char(10)
|
||||
write(25) "Line 2" // char(10)
|
||||
write(25) "Line 3" // char(10)
|
||||
write(25) "Line 4" // char(10)
|
||||
write(25) "Line 5" ! No EOR marker on the last line.
|
||||
close(25, status="keep")
|
||||
open(25, file="test.dat", status="old")
|
||||
do n=1,10
|
||||
read(25,'(a)',end=100,err=101) line
|
||||
k = k+1
|
||||
enddo
|
||||
call abort
|
||||
100 if (k /= 5) call abort
|
||||
stop
|
||||
101 call abort
|
||||
end program test
|
||||
|
Loading…
x
Reference in New Issue
Block a user