Merge from mainline
[official-gcc.git] / gcc / testsuite / gfortran.dg / list_read_2.f90
blobe757f613e4401b82ec02d02dcc6e4fa7503c23a6
1 ! { dg-do run }
2 ! PR16805
3 ! Test list directed reads from character substrings
4 ! The IO library was reporting an error rather the end-of-record when it
5 ! got to the end of an internal file record.
6 program list_read_2
7 implicit none
8 character*10 a
9 data a /'1234567890'/
10 integer i
11 logical debug
12 data debug /.TRUE./
13 read(a,*)i
14 if (i.ne.1234567890) call abort
15 read(a(1:1),*)i
16 if (i.ne.1) call abort
17 read(a(2:2),*)i
18 if (i.ne.2) call abort
19 read(a(1:5),*)i
20 if (i.ne.12345) call abort
21 read(a(5:10),*)i
22 if (i.ne.567890) call abort
23 read(a(10:10),*)i
24 if (i.ne.0) call abort
25 end