| 1 |
! { dg-do run } |
| 2 |
! PR37707 Namelist read of array of derived type incorrect |
| 3 |
! Test case from Tobias Burnus |
| 4 |
IMPLICIT NONE |
| 5 |
integer :: j |
| 6 |
character(len=5) :: str(4) |
| 7 |
character(len=900) :: nlstr |
| 8 |
namelist /nml/ str, j |
| 9 |
str = '' |
| 10 |
j = -42 |
| 11 |
nlstr = '&nml str = "a", "b", "cde", j = 5 /' |
| 12 |
read(nlstr,nml) |
| 13 |
open(99, status="scratch") |
| 14 |
write(99,nml) |
| 15 |
rewind(99) |
| 16 |
j = -54 |
| 17 |
str = 'XXXX' |
| 18 |
read(99,nml) |
| 19 |
if (j.ne.5) STOP 1 |
| 20 |
if (any(str.ne.["a ","b ","cde "," "])) STOP 2 |
| 21 |
close(99) |
| 22 |
end |