| 1 |
! { dg-do run } |
| 2 |
! PR91200 |
| 3 |
program foo |
| 4 |
implicit none |
| 5 |
integer fd |
| 6 |
open(newunit=fd, file='test.dat', access='stream', form='formatted') |
| 7 |
write(fd,'(A)') '$MeshFormat' |
| 8 |
write(fd,'(A)') 'aabbccdd' |
| 9 |
close(fd) |
| 10 |
call readfile ! Read test.dat |
| 11 |
contains |
| 12 |
subroutine readfile |
| 13 |
character(len=20) buf1, buf2 |
| 14 |
integer fd, m, n |
| 15 |
open(newunit=fd, file='test.dat', access='stream', form='formatted') |
| 16 |
inquire(fd, pos=m) |
| 17 |
if (m /= 1) stop 'm /= 1' |
| 18 |
read(fd, *) buf1 |
| 19 |
read(fd, *, pos=m) buf2 ! Reread by using pos=1 |
| 20 |
close(fd, status='delete') |
| 21 |
if (buf1 /= buf2) stop 'wrong' |
| 22 |
end subroutine readfile |
| 23 |
end program |