| 1 |
!{ dg-do run } |
| 2 |
! Tests simple derived types. |
| 3 |
! Provided by Paul Thomas - [email protected] |
| 4 |
|
| 5 |
program namelist_13 |
| 6 |
|
| 7 |
type :: yourtype |
| 8 |
integer, dimension(2) :: yi = (/8,9/) |
| 9 |
real, dimension(2) :: yx = (/80.,90./) |
| 10 |
character(len=2) :: ych = "xx" |
| 11 |
end type yourtype |
| 12 |
|
| 13 |
type :: mytype |
| 14 |
integer, dimension(2) :: myi = (/800,900/) |
| 15 |
real, dimension(2) :: myx = (/8000.,9000./) |
| 16 |
character(len=2) :: mych = "zz" |
| 17 |
type(yourtype) :: my_yourtype |
| 18 |
end type mytype |
| 19 |
|
| 20 |
type(mytype) :: z |
| 21 |
integer :: ier |
| 22 |
integer :: zeros(10) |
| 23 |
namelist /mynml/ zeros, z |
| 24 |
|
| 25 |
zeros = 0 |
| 26 |
zeros(5) = 1 |
| 27 |
|
| 28 |
open(10,status="scratch", delim="apostrophe") |
| 29 |
write (10, nml=mynml, iostat=ier) |
| 30 |
if (ier.ne.0) STOP 1 |
| 31 |
|
| 32 |
rewind (10) |
| 33 |
read (10, NML=mynml, IOSTAT=ier) |
| 34 |
if (ier.ne.0) STOP 2 |
| 35 |
close (10) |
| 36 |
|
| 37 |
end program namelist_13 |
| 38 |
|