2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / read_noadvance.f90
blobe55763ad8bbaae96e13c9f938217cf4c7853c794
1 ! { dg-do run }
2 ! pr24719, non-advancing read should read more than one line
3 ! test contributed by jerry delisle <jvdelisle@gcc.gnu.org>
4 implicit none
5 character(1) :: chr
6 character(20) :: correct = 'foo: bar 123abc'
7 integer :: i
8 open(unit = 11, status = "scratch", action="readwrite")
9 write(11,'(a)') "foo: bar"
10 write(11,'(a)') "123abc"
11 rewind(11)
12 i = 0
14 i = i + 1
15 10 read(unit = 11, fmt = '(a)', advance = 'no', end = 99, eor = 11) chr
16 if (chr.ne.correct(i:i)) call abort()
17 cycle
18 11 continue
19 end do
20 99 close(11)
21 end