2015-07-03 Christophe Lyon <christophe.lyon@linaro.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / list_read_2.f90
blob3e6c233c09a7e040b0aac8fc5364799ffb517f71
1 ! { dg-do run }
2 ! { dg-options "-std=legacy" }
4 ! PR16805
5 ! Test list directed reads from character substrings
6 ! The IO library was reporting an error rather the end-of-record when it
7 ! got to the end of an internal file record.
8 program list_read_2
9 implicit none
10 character*10 a
11 data a /'1234567890'/
12 integer i
13 logical debug
14 data debug /.TRUE./
15 read(a,*)i
16 if (i.ne.1234567890) call abort
17 read(a(1:1),*)i
18 if (i.ne.1) call abort
19 read(a(2:2),*)i
20 if (i.ne.2) call abort
21 read(a(1:5),*)i
22 if (i.ne.12345) call abort
23 read(a(5:10),*)i
24 if (i.ne.567890) call abort
25 read(a(10:10),*)i
26 if (i.ne.0) call abort
27 end