| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR libfortran/51825 |
| 4 |
! Test case regarding namelist problems with derived types |
| 5 |
|
| 6 |
program namelist |
| 7 |
|
| 8 |
type d1 |
| 9 |
integer :: j = 0 |
| 10 |
end type d1 |
| 11 |
|
| 12 |
type d2 |
| 13 |
type(d1) k |
| 14 |
end type d2 |
| 15 |
|
| 16 |
type d3 |
| 17 |
type(d2) d(2) |
| 18 |
end type d3 |
| 19 |
|
| 20 |
type(d3) der |
| 21 |
namelist /nmlst/ der |
| 22 |
|
| 23 |
open (10, status='scratch') |
| 24 |
write (10, '(a)') "&NMLST" |
| 25 |
write (10, '(a)') " DER%D(1)%K%J = 1," |
| 26 |
write (10, '(a)') " DER%D(2)%K%J = 2," |
| 27 |
write (10, '(a)') "/" |
| 28 |
rewind(10) |
| 29 |
read(10, nml=nmlst) |
| 30 |
close (10) |
| 31 |
|
| 32 |
if (der%d(1)%k%j /= 1) STOP 1 |
| 33 |
if (der%d(2)%k%j /= 2) STOP 2 |
| 34 |
end program namelist |