Fix PR48484
[official-gcc.git] / gcc / testsuite / gfortran.dg / streamio_4.f90
blobce638a415add069037379fcbdbb36fcdcb9411c3
1 ! { dg-do run }
2 ! PR25828 Stream IO test 4, Tests string read and writes, single byte.
3 ! Verifies buffering is working correctly and position="append"
4 ! Contributed by Jerry DeLisle <jvdelisle@verizon.net>.
5 program streamtest
6 implicit none
7 character(1) :: lf = char(10)
8 character(1) :: tchar
9 integer :: i,j,k
10 integer, parameter :: lines = 5231
12 open(10, file="teststream", access="stream", form="formatted")
14 do i=1,lines
15 do j=0,9
16 write(10,"(i5)") j
17 end do
18 end do
20 close(10)
22 open(10, file="teststream", access="stream",&
23 &form="formatted", position="append")
24 do i=1,lines
25 do j=0,9
26 write(10,"(i5)") j
27 end do
28 end do
29 rewind(10)
30 do i=1,lines
31 do j=0,9
32 read(10,"(i5)") k
33 if (k.ne.j) call abort()
34 end do
35 end do
37 close(10,status="delete")
38 end program streamtest