PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / backspace_5.f
blob4cd657a78389d21c13a2e2920f469331249693ff
1 !{ dg-do run }
2 ! PR26464 File I/O error related to buffering and BACKSPACE
3 ! Test case derived from case by Dale Ranta.
4 ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
5 program test
6 integer,parameter :: datasize = 1000
7 dimension idata(datasize)
8 idata = -42
9 open (11, status="scratch", form="unformatted")
10 idata(1) = -1
11 idata( datasize) = -2
12 write(11)idata
13 idata(1) = -2
14 idata( datasize) = -3
15 write(11)idata
16 idata(1) = -3
17 idata( datasize) = -4
18 write(11)idata
19 idata(1) = -4
20 idata( datasize) = -5
21 write(11)idata
22 read(11,end= 1000 )idata
23 call abort()
24 1000 continue
25 backspace 11
26 backspace 11
27 backspace 11
28 read(11,end= 1001 )idata
29 if(idata(1).ne.-3 .or. idata(datasize).ne.-4) call abort()
30 stop
31 1001 continue
32 call abort()
33 1010 stop
34 end