2011-02-13 Tobias Burnus <burnus@net-b.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / backspace_10.f90
blob574d464c4b3659887c44042e12889eab202908c9
1 ! { dg-do run }
2 ! PR33307 I/O read/positioning problem - in BACKSPACE
3 ! Test case devloped from test in PR by Jerry DeLisle <jvdelisle@gcc.gnu.org>
4 program gfcbug69b
5 ! Modified example program
6 implicit none
7 integer, parameter :: iunit = 63
8 integer :: istat, k, ios
9 character(len=20) :: line, message
11 open (iunit)
12 write (iunit, '(a)') "! ***Remove this line***"
13 write (iunit, '(a)') "&FOO file='foo' /"
14 write (iunit, '(a)', advance="no") "&BAR file='bar' /"
15 close (iunit)
16 ! Note: Failure occurred only when ACTION="read" was specified
17 open (iunit, action="read", status="old")
19 read (iunit,'(a)',iostat=ios) line
20 if (ios /= 0) call abort
21 read (iunit,'(a)',iostat=ios) line
22 if (ios /= 0) call abort
23 read (iunit,'(a)',iostat=ios) line
24 if (ios /= 0) call abort
25 read (iunit,'(a)',iostat=ios) line
26 if (ios /= 0) backspace (iunit)
27 rewind (iunit)
28 read (iunit,'(a)',iostat=ios) line
29 if (ios /= 0) call abort
30 read (iunit,'(a)',iostat=ios) line
31 if (ios /= 0) call abort
32 read (iunit,'(a)',iostat=ios) line
33 if (ios /= 0) call abort
34 read (iunit,'(a)',iostat=ios) line
35 if (ios /= -1) call abort
36 close (iunit, status="delete")
37 end program gfcbug69b