2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / write_rewind_1.f
blob94fec99df7cb90ea0fd37643610526b9630fe987
1 ! { dg-do run { target fd_truncate } }
2 ! PR 26499 : Positioning of EOF after write and rewind.
3 ! Test case from Dale Ranta in PR.
4 ! Submitted by Jerry DeLisle <jvdelisle@verizon.net>.
5 program test
6 dimension idata(100)
7 idata = -42
8 open(unit=11,form='unformatted')
9 write(11)idata
10 write(11)idata
11 read(11,end= 1000 )idata
12 call abort()
13 1000 continue
14 rewind 11
15 write(11)idata
16 close(11,status='keep')
17 open(unit=11,form='unformatted')
18 rewind 11
19 read(11)idata
20 read(11, end=250)idata
21 call abort()
22 250 continue
23 close(11,status='delete')
24 end