* cfgloopmanip.c (duplicate_loop_to_header_edge): Cleanup profile
[official-gcc.git] / gcc / testsuite / gfortran.dg / endfile.f90
blob60875ce23380df7dfd5c5f09a762eb8d47c63dac
1 ! { dg-do run { target fd_truncate } }
2 ! pr18364 endfile does not truncate file.
3 ! write out 20 records
4 ! rewind
5 ! read 10 records
6 ! endfile
7 ! close file
8 ! open file
9 ! detect file has only 10 records
10 implicit none
11 integer i,j
12 open(unit=10,file='test.dat',access='sequential',status='replace')
13 do i=1, 20
14 write (10,'(I4)') i
15 end do
16 rewind(10)
17 do i=1,10
18 read (10,'(I4)') j
19 end do
20 endfile(10)
21 close(10)
22 open(unit=10,file='test.dat',access='sequential',status='old')
23 do i=1,20
24 read (10,'(I4)',end=99) j
25 end do
26 ! should never get here
27 call abort
28 99 continue ! end of file
29 if (j.ne.10) call abort
30 close(10,status='delete')
31 end