Merge to HEAD at tree-cleanup-merge-20041024 .
[official-gcc.git] / gcc / testsuite / gfortran.dg / direct_io_1.f90
blobdb79c6e959871aeb054fb2f5c41550c35103735c
1 ! PR 16908
2 ! Segfaulted on second set of writes. We weren't handling partial records
3 ! properly when calculating the file position.
4 program direct_io_1
5 implicit none
7 integer n, nt, mt, m
8 real dt, tm, w
9 real, allocatable :: p(:)
11 nt = 2049 ! if nt < 2049, then everything works.
13 allocate(p(nt))
14 p = 0.e0
16 inquire(iolength=mt) (p(m), m=1, nt)
18 open(unit=12, file='syn.sax', access='direct', recl=mt)
19 n = 1
20 write(12, rec=n) mt, nt
21 write(12, rec=n+1) (p(m), m=1, nt)
22 close(12)
24 inquire(iolength=mt) (p(m), m=1, nt)
26 open(unit=12, file='syn.sax', access='direct', recl=mt)
27 n = 1
28 write(12, rec=n) mt, nt
29 write(12, rec=n+1) (p(m), m=1, nt)
30 close(12)
31 end program