gcc/testsuite/gfortran.dg/unf_short_record_1.f90
raw| 1 | ! { dg-do run } |
| 2 | ! PR 29627 - partial reads of unformatted records |
| 3 | program main |
| 4 | character a(3) |
| 5 | character(len=50) msg |
| 6 | open(10, form="unformatted", status="unknown") |
| 7 | write (10) 'a' |
| 8 | write (10) 'c' |
| 9 | a = 'b' |
| 10 | rewind 10 |
| 11 | read (10, err=20, iomsg=msg) a |
| 12 | STOP 1 |
| 13 | 20 continue |
| 14 | if (msg .ne. "I/O past end of record on unformatted file") STOP 2 |
| 15 | if (a(1) .ne. 'a' .or. a(2) .ne. 'b' .or. a(3) .ne. 'b') STOP 3 |
| 16 | close (10, status="delete") |
| 17 | end program main |