| 1 |
! { dg-do run } |
| 2 |
! PR 34405 - direct access prohibits ENDFILE, BACKSPACE and REWIND |
| 3 |
program test |
| 4 |
implicit none |
| 5 |
integer :: ios |
| 6 |
character(len=80) :: msg |
| 7 |
open (95, access="direct", recl=4, status="scratch") |
| 8 |
write (95,rec=1) 'abcd' |
| 9 |
|
| 10 |
ios = 0 |
| 11 |
msg = " " |
| 12 |
backspace (95,iostat=ios,iomsg=msg) |
| 13 |
if (ios == 0 .or. & |
| 14 |
msg /= "Cannot BACKSPACE a file opened for DIRECT access") STOP 1 |
| 15 |
|
| 16 |
ios = 0 |
| 17 |
msg = " " |
| 18 |
endfile (95,iostat=ios,iomsg=msg) |
| 19 |
if (ios == 0 .or. & |
| 20 |
msg /= "Cannot perform ENDFILE on a file opened for DIRECT access") & |
| 21 |
STOP 2 |
| 22 |
|
| 23 |
ios = 0 |
| 24 |
msg = " " |
| 25 |
rewind (95,iostat=ios,iomsg=msg) |
| 26 |
if (ios == 0 .or. & |
| 27 |
msg /= "Cannot REWIND a file opened for DIRECT access ") STOP 3 |
| 28 |
|
| 29 |
close (95) |
| 30 |
end program test |
| 31 |
|