| 1 |
! { dg-do run } |
| 2 |
! PR25307 Check handling of end-of-file conditions for list directed reads. |
| 3 |
! Prepared by Jerry DeLisle <[email protected]> |
| 4 |
program pr25307 |
| 5 |
character(len=10) :: str |
| 6 |
character(len=10) :: a(5) |
| 7 |
a="" |
| 8 |
a(1)="123" |
| 9 |
a(3)="234" |
| 10 |
str = '123' |
| 11 |
! Check internal unit |
| 12 |
i = 0 |
| 13 |
j = 0 |
| 14 |
read( str, *, end=10 ) i,j |
| 15 |
STOP 1 |
| 16 |
10 continue |
| 17 |
if (i.ne.123) STOP 2 |
| 18 |
if (j.ne.0) STOP 3 |
| 19 |
! Check file unit |
| 20 |
i = 0 |
| 21 |
open(10, status="scratch") |
| 22 |
write(10,'(a)') "123" |
| 23 |
rewind(10) |
| 24 |
read(10, *, end=20) i,j |
| 25 |
STOP 4 |
| 26 |
20 continue |
| 27 |
if (i.ne.123) STOP 5 |
| 28 |
if (j.ne.0) STOP 6 |
| 29 |
! Check internal array unit |
| 30 |
i = 0 |
| 31 |
j = 0 |
| 32 |
k = 0 |
| 33 |
read(a(1:5:2),*, end=30)i,j,k |
| 34 |
STOP 7 |
| 35 |
30 continue |
| 36 |
if (i.ne.123) STOP 8 |
| 37 |
if (j.ne.234) STOP 9 |
| 38 |
if (k.ne.0) STOP 10 |
| 39 |
end program pr25307 |