| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-std=legacy" } |
| 3 |
! |
| 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) STOP 1 |
| 17 |
read(a(1:1),*)i |
| 18 |
if (i.ne.1) STOP 2 |
| 19 |
read(a(2:2),*)i |
| 20 |
if (i.ne.2) STOP 3 |
| 21 |
read(a(1:5),*)i |
| 22 |
if (i.ne.12345) STOP 4 |
| 23 |
read(a(5:10),*)i |
| 24 |
if (i.ne.567890) STOP 5 |
| 25 |
read(a(10:10),*)i |
| 26 |
if (i.ne.0) STOP 6 |
| 27 |
end |