Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gfortran.dg / streamio_14.f90
blob54522fe6bd5c10b00f65166411246a87a4a24a82
1 ! { dg-do run }
2 ! Test that we can write an unformatted stream file without
3 ! truncating.
4 program main
5 character (len=10) c
6 open(10, form="unformatted", access="stream", position="rewind")
7 write (10) '1234567890abcde'
8 c = ''
9 read (10,pos=1) c
10 if (c /= '1234567890') call abort
11 c = ''
12 read (10,pos=6) c
13 if (c /= '67890abcde') call abort
14 write (10,pos=3) 'AB'
15 c = ''
16 read (10,pos=1) c
17 if (c /= '12AB567890') call abort
18 c = ''
19 read (10,pos=6) c
20 if (c /= '67890abcde') call abort
21 close (10,status="delete")
22 end program main