Fix warnings occured during profiledboostrap on
[official-gcc.git] / gcc / testsuite / gfortran.dg / read_eof_1.f90
blob78ff14a5d9b41b1c74ec6550c9efd72e9cd1311a
1 ! { dg-do run { target fd_truncate } }
2 ! PR25697 Check that reading from a file that is at end-of-file does not
3 ! segfault or give error. Test case derived from example in PR from Dale Ranta.
4 ! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
5 integer data(9)
6 do i = 1,9
7 data(i)=-3
8 enddo
9 open(unit=11,status='scratch',form='unformatted')
10 write(11)data
11 read(11,end= 1000 )data
12 call abort()
13 1000 continue
14 backspace 11
15 backspace 11
16 write(11)data
17 rewind 11
18 data = 0
19 read(11,end= 1001 )data
20 1001 continue
21 read(11,end= 1002 )data
22 call abort
23 1002 continue
24 if (.not. all(data == -3)) call abort()
25 close(11)
26 end