1! { dg-do run }
2! PR43265: See comment #26 in the PR.  Before patch,
3! the test case would fail to read the last line of the file.
4! Thanks to Jean-Baptiste Faure for providing the initial test case.
5program test
6  character (len=6) :: line
7  integer :: n, k=0
8  open(unit=25,file="test.dat",status="replace", &
9       & form="unformatted", access="stream")
10  write(25) "Line 1" // char(10)
11  write(25) "Line 2" // char(10)
12  write(25) "Line 3" // char(10)
13  write(25) "Line 4" // char(10)
14  write(25) "Line 5" ! No EOR marker on the last line.
15  close(25, status="keep")
16  open(25, file="test.dat", status="old")
17  do n=1,10
18   read(25,'(a)',end=100,err=101) line
19   k = k+1
20  enddo
21  STOP 1
22100 if (k /= 5) STOP 2
23  close(25, status="delete")
24  stop
25101 STOP 3
26end program test
27
28