| 1 |
! { dg-do run } |
| 2 |
! PR33307 I/O read/positioning problem - in BACKSPACE |
| 3 |
! Test case devloped from test in PR by Jerry DeLisle <[email protected]> |
| 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 |
| 10 |
|
| 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") |
| 18 |
|
| 19 |
read (iunit,'(a)',iostat=ios) line |
| 20 |
if (ios /= 0) STOP 1 |
| 21 |
read (iunit,'(a)',iostat=ios) line |
| 22 |
if (ios /= 0) STOP 2 |
| 23 |
read (iunit,'(a)',iostat=ios) line |
| 24 |
if (ios /= 0) STOP 3 |
| 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) STOP 4 |
| 30 |
read (iunit,'(a)',iostat=ios) line |
| 31 |
if (ios /= 0) STOP 5 |
| 32 |
read (iunit,'(a)',iostat=ios) line |
| 33 |
if (ios /= 0) STOP 6 |
| 34 |
read (iunit,'(a)',iostat=ios) line |
| 35 |
if (ios /= -1) STOP 7 |
| 36 |
close (iunit, status="delete") |
| 37 |
end program gfcbug69b |