2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / read_size_noadvance.f90
blobe611547b63b36f38f999bb9f61c8ca903ab30e08
1 ! { dg-do run }
2 ! PR26890 Test for use of SIZE variable in IO list.
3 ! Test case from Paul Thomas.
4 ! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
6 character(80) :: buffer, line
7 integer :: nchars
8 line = "The quick brown fox jumps over the lazy dog."
9 open (10, status="scratch")
10 write (10, '(a)') trim(line)
11 rewind (10)
12 read (10, '(a)', advance = 'no', size = nchars, eor = 998) buffer
13 call abort()
14 998 if (nchars.ne.44) call abort()
15 rewind (10)
16 buffer = "how about some random text here just to be sure on this one."
17 nchars = 80
18 read (10, '(a)', advance = 'no', size = nchars, eor = 999) buffer(:nchars)
19 999 if (nchars.ne.44) call abort()
20 if (buffer.ne.line) call abort()
21 close (10)
22 end