Debian Codegraph @

gcc/testsuite/gfortran.dg/read_eof_1.f90

raw
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 <[email protected]>
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 STOP 1
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 STOP 1
23 1002 continue
24 if (.not. all(data == -3)) STOP 2
25 close(11)
26 end
27