6 ! Run-time test for Fortran 2003 NAMELISTS
7 ! Version for non-strings
12 character(len
=1000) :: str
14 integer, allocatable
:: a(:)
15 integer, allocatable
:: b
16 integer, pointer :: ap(:)
17 integer, pointer :: bp
26 type(t
),allocatable
:: g
,h(:)
27 type(t
),pointer :: i
,j(:)
29 namelist /nml
/ a
, b
, c
, d
, ap
, bp
,e
,f
,g
,h
,i
,j
40 e
%c2
= [-702,-703,-704]
43 f(1)%c2
= [44001,44002,44003]
44 f(2)%c2
= [44011,44012,44013]
46 allocate(g
,h(2),i
,j(2))
49 g
%c2
= [-602,6703,-604]
52 h(1)%c2
= [45001,45002,45003]
53 h(2)%c2
= [45011,45012,45013]
56 i
%c2
= [-502,-503,-504]
59 j(1)%c2
= [46001,46002,46003]
60 j(2)%c2
= [46011,46012,46013]
63 str
= repeat('X', len(str
))
99 if (any (a
/= [1,2])) call abort()
100 if (any (ap
/= [98, 99])) call abort()
101 if (b
/= 7) call abort()
102 if (bp
/= 101) call abort()
103 if (c
/= 8) call abort()
104 if (any (d
/= [-1, -2, -3])) call abort()
106 if (e
%c1
/= -701) call abort()
107 if (any (e
%c2
/= [-702,-703,-704])) call abort()
108 if (f(1)%c1
/= 33001) call abort()
109 if (f(2)%c1
/= 33002) call abort()
110 if (any (f(1)%c2
/= [44001,44002,44003])) call abort()
111 if (any (f(2)%c2
/= [44011,44012,44013])) call abort()
113 if (g
%c1
/= -601) call abort()
114 if (any(g
%c2
/= [-602,6703,-604])) call abort()
115 if (h(1)%c1
/= 35001) call abort()
116 if (h(2)%c1
/= 35002) call abort()
117 if (any (h(1)%c2
/= [45001,45002,45003])) call abort()
118 if (any (h(2)%c2
/= [45011,45012,45013])) call abort()
120 if (i
%c1
/= -501) call abort()
121 if (any (i
%c2
/= [-502,-503,-504])) call abort()
122 if (j(1)%c1
/= 36001) call abort()
123 if (j(2)%c1
/= 36002) call abort()
124 if (any (j(1)%c2
/= [46001,46002,46003])) call abort()
125 if (any (j(2)%c2
/= [46011,46012,46013])) call abort()
127 ! Check argument passing (dummy processing)
128 call test2(a
,b
,c
,d
,ap
,bp
,e
,f
,g
,h
,i
,j
,2)
131 subroutine test2(x1
,x2
,x3
,x4
,x1p
,x2p
,x6
,x7
,x8
,x9
,x10
,x11
,n
)
132 integer, allocatable
:: x1(:)
133 integer, allocatable
:: x2
134 integer, pointer :: x1p(:)
135 integer, pointer :: x2p
141 type(t
),allocatable
:: x8
,x9(:)
142 type(t
),pointer :: x10
,x11(:)
145 namelist /nml2
/ x1
, x2
, x3
, x4
,x5
,x1p
,x2p
,x6
,x7
,x8
,x9
,x10
,x11
,x12
151 x12(1)%c2
= [47001,47002,47003]
152 x12(2)%c2
= [47011,47012,47013]
155 str
= repeat('X', len(str
))
170 x7(1)%c2
= [-1,-1,-1]
171 x7(2)%c2
= [-1,-1,-1]
177 x9(1)%c2
= [-1,-1,-1]
178 x9(2)%c2
= [-1,-1,-1]
184 x11(1)%c2
= [-1,-1,-1]
185 x11(2)%c2
= [-1,-1,-1]
191 x12(1)%c2
= [-1,-1,-1]
192 x12(2)%c2
= [-1,-1,-1]
198 if (any (x1
/= [1,2])) call abort()
199 if (any (x1p
/= [98, 99])) call abort()
200 if (x2
/= 7) call abort()
201 if (x2p
/= 101) call abort()
202 if (x3
/= 8) call abort()
203 if (any (x4
/= [-1, -2, -3])) call abort()
205 if (x6
%c1
/= -701) call abort()
206 if (any (x6
%c2
/= [-702,-703,-704])) call abort()
207 if (x7(1)%c1
/= 33001) call abort()
208 if (x7(2)%c1
/= 33002) call abort()
209 if (any (x7(1)%c2
/= [44001,44002,44003])) call abort()
210 if (any (x7(2)%c2
/= [44011,44012,44013])) call abort()
212 if (x8
%c1
/= -601) call abort()
213 if (any(x8
%c2
/= [-602,6703,-604])) call abort()
214 if (x9(1)%c1
/= 35001) call abort()
215 if (x9(2)%c1
/= 35002) call abort()
216 if (any (x9(1)%c2
/= [45001,45002,45003])) call abort()
217 if (any (x9(2)%c2
/= [45011,45012,45013])) call abort()
219 if (x10
%c1
/= -501) call abort()
220 if (any (x10
%c2
/= [-502,-503,-504])) call abort()
221 if (x11(1)%c1
/= 36001) call abort()
222 if (x11(2)%c1
/= 36002) call abort()
223 if (any (x11(1)%c2
/= [46001,46002,46003])) call abort()
224 if (any (x11(2)%c2
/= [46011,46012,46013])) call abort()
226 if (any (x5
/= [ 42, 53 ])) call abort()
228 if (x12(1)%c1
/= 37001) call abort()
229 if (x12(2)%c1
/= 37002) call abort()
230 if (any (x12(1)%c2
/= [47001,47002,47003])) call abort()
231 if (any (x12(2)%c2
/= [47011,47012,47013])) call abort()