| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-std=f2003" } |
| 3 |
! PR109662-a semi-colon after namelist name accepted on input. |
| 4 |
program testnmlread |
| 5 |
implicit none |
| 6 |
character(16) :: line = '&stuff; n = 759/' |
| 7 |
character(100)::message |
| 8 |
integer :: n, i, ioresult |
| 9 |
namelist/stuff/n |
| 10 |
message = "" |
| 11 |
ioresult = 0 |
| 12 |
n = 99 |
| 13 |
read(line,nml=stuff,iostat=ioresult) |
| 14 |
if (ioresult == 0) STOP 13 ! Should error with the semi-colon in there. |
| 15 |
|
| 16 |
! Intentional short input (-> EOF) |
| 17 |
line = "&stuff" |
| 18 |
! Problem manifests on two bad reads on same string. |
| 19 |
do i = 1, 6 |
| 20 |
n = -1 |
| 21 |
ioresult = 0 |
| 22 |
|
| 23 |
read (line,nml=stuff,iostat=ioresult) |
| 24 |
if (n /= -1) STOP 24 |
| 25 |
if (ioresult == 0) STOP 25 |
| 26 |
end do |
| 27 |
|
| 28 |
end program testnmlread |