Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gfortran.dg / unf_short_record_1.f90
blob9dca08e5eceb13267b9d0ce41f9d2069c5afb5be
1 ! { dg-do run { target fd_truncate } }
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 call abort
13 20 continue
14 if (msg .ne. "I/O past end of record on unformatted file") call abort
15 if (a(1) .ne. 'a' .or. a(2) .ne. 'b' .or. a(3) .ne. 'b') call abort
16 close (10, status="delete")
17 end program main