| 1 |
! { dg-do run } |
| 2 |
! PR 20661: Handle non-advancing I/O with iostat |
| 3 |
! Test case by Walt Brainerd, The Fortran Company |
| 4 |
|
| 5 |
program fc002 |
| 6 |
character(len=1) :: c |
| 7 |
integer :: k,k2 |
| 8 |
character(len=*), parameter :: f="(a)" |
| 9 |
open(11,status="scratch", iostat=k) |
| 10 |
if (k /= 0) STOP 1 |
| 11 |
write(11,f) "x" |
| 12 |
rewind (11) |
| 13 |
read(11, f, advance="no", iostat=k) c |
| 14 |
if (k /= 0) STOP 2 |
| 15 |
read(11, f, advance="no", iostat=k) c |
| 16 |
if (k >= 0) STOP 3 |
| 17 |
read(11, f, advance="no", iostat=k2) c |
| 18 |
if (k2 >= 0 .or. k == k2) STOP 4 |
| 19 |
end program fc002 |