4 ! Test passing of missing optional scalar dummies of intrinsic type
18 integer, intent(in
) :: i
19 integer ,optional
:: j
20 integer, allocatable
:: aa
21 integer, pointer :: pp
=> NULL()
22 if (present (j
)) error
stop "j is present"
31 subroutine one_val (i
, j
)
32 integer, intent(in
) :: i
33 integer, value
, optional
:: j
34 if (present (j
)) error
stop "j is present"
39 subroutine one_all (i
, j
)
40 integer, intent(in
) :: i
41 integer, allocatable
,optional
:: j
42 if (present (j
)) error
stop "j is present"
43 ! call two (i, j) ! invalid per F2018:15.5.2.12, par. 3, clause 8
44 ! call two_val (i, j) ! dto.
48 subroutine one_ptr (i
, j
)
49 integer, intent(in
) :: i
50 integer, pointer ,optional
:: j
51 if (present (j
)) error
stop "j is present"
52 ! call two (i, j) ! invalid per F2018:15.5.2.12, par. 3, clause 7
53 ! call two_val (i, j) ! dto.
58 integer, intent(in
) :: i
59 integer, intent(in
), optional
:: j
60 if (present (j
)) error
stop 11
63 subroutine two_val (i
, j
)
64 integer, intent(in
) :: i
65 integer, value
, optional
:: j
66 if (present (j
)) error
stop 12
69 subroutine two_all (i
, j
)
70 integer, intent(in
) :: i
71 integer, allocatable
,optional
:: j
72 if (present (j
)) error
stop 13
75 subroutine two_ptr (i
, j
)
76 integer, intent(in
) :: i
77 integer, pointer, optional
:: j
78 if (present (j
)) error
stop 14
85 subroutine test_char ()
94 character, intent(in
) :: i
95 character ,optional
:: j
96 character, allocatable
:: aa
97 character, pointer :: pp
=> NULL()
98 if (present (j
)) error
stop "j is present"
105 subroutine one_val (i
, j
)
106 character, intent(in
) :: i
107 character, value
, optional
:: j
108 if (present (j
)) error
stop "j is present"
113 subroutine one_all (i
, j
)
114 character, intent(in
) :: i
115 character, allocatable
,optional
:: j
116 if (present (j
)) error
stop "j is present"
117 ! call two (i, j) ! invalid per F2018:15.5.2.12, par. 3, clause 8
118 ! call two_val (i, j) ! dto.
122 subroutine one_ptr (i
, j
)
123 character, intent(in
) :: i
124 character, pointer ,optional
:: j
125 if (present (j
)) error
stop "j is present"
126 ! call two (i, j) ! invalid per F2018:15.5.2.12, par. 3, clause 7
127 ! call two_val (i, j) ! dto.
131 subroutine two (i
, j
)
132 character, intent(in
) :: i
133 character, intent(in
), optional
:: j
134 if (present (j
)) error
stop 21
137 subroutine two_val (i
, j
)
138 character, intent(in
) :: i
139 character, value
, optional
:: j
140 if (present (j
)) error
stop 22
143 subroutine two_all (i
, j
)
144 character, intent(in
) :: i
145 character, allocatable
,optional
:: j
146 if (present (j
)) error
stop 23
149 subroutine two_ptr (i
, j
)
150 character, intent(in
) :: i
151 character, pointer, optional
:: j
152 if (present (j
)) error
stop 24
159 subroutine test_char4 ()
160 character(kind
=4) :: k
= 4_
"#"
167 subroutine one (i
, j
)
168 character(kind
=4), intent(in
) :: i
169 character(kind
=4) ,optional
:: j
170 character(kind
=4), allocatable
:: aa
171 character(kind
=4), pointer :: pp
=> NULL()
172 if (present (j
)) error
stop "j is present"
179 subroutine one_val (i
, j
)
180 character(kind
=4), intent(in
) :: i
181 character(kind
=4), value
, optional
:: j
182 if (present (j
)) error
stop "j is present"
187 subroutine one_all (i
, j
)
188 character(kind
=4), intent(in
) :: i
189 character(kind
=4), allocatable
,optional
:: j
190 if (present (j
)) error
stop "j is present"
191 ! call two (i, j) ! invalid per F2018:15.5.2.12, par. 3, clause 8
192 ! call two_val (i, j) ! dto.
196 subroutine one_ptr (i
, j
)
197 character(kind
=4), intent(in
) :: i
198 character(kind
=4), pointer ,optional
:: j
199 if (present (j
)) error
stop "j is present"
200 ! call two (i, j) ! invalid per F2018:15.5.2.12, par. 3, clause 7
201 ! call two_val (i, j) ! dto.
205 subroutine two (i
, j
)
206 character(kind
=4), intent(in
) :: i
207 character(kind
=4), intent(in
), optional
:: j
208 if (present (j
)) error
stop 31
211 subroutine two_val (i
, j
)
212 character(kind
=4), intent(in
) :: i
213 character(kind
=4), value
, optional
:: j
214 if (present (j
)) error
stop 32
217 subroutine two_all (i
, j
)
218 character(kind
=4), intent(in
) :: i
219 character(kind
=4), allocatable
,optional
:: j
220 if (present (j
)) error
stop 33
223 subroutine two_ptr (i
, j
)
224 character(kind
=4), intent(in
) :: i
225 character(kind
=4), pointer, optional
:: j
226 if (present (j
)) error
stop 34
233 subroutine test_complex ()
241 subroutine one (i
, j
)
242 complex, intent(in
) :: i
243 complex ,optional
:: j
244 complex, allocatable
:: aa
245 complex, pointer :: pp
=> NULL()
246 if (present (j
)) error
stop "j is present"
253 subroutine one_val (i
, j
)
254 complex, intent(in
) :: i
255 complex, value
, optional
:: j
256 if (present (j
)) error
stop "j is present"
261 subroutine one_all (i
, j
)
262 complex, intent(in
) :: i
263 complex, allocatable
,optional
:: j
264 if (present (j
)) error
stop "j is present"
265 ! call two (i, j) ! invalid per F2018:15.5.2.12, par. 3, clause 8
266 ! call two_val (i, j) ! dto.
270 subroutine one_ptr (i
, j
)
271 complex, intent(in
) :: i
272 complex, pointer ,optional
:: j
273 if (present (j
)) error
stop "j is present"
274 ! call two (i, j) ! invalid per F2018:15.5.2.12, par. 3, clause 7
275 ! call two_val (i, j) ! dto.
279 subroutine two (i
, j
)
280 complex, intent(in
) :: i
281 complex, intent(in
), optional
:: j
282 if (present (j
)) error
stop 41
285 subroutine two_val (i
, j
)
286 complex, intent(in
) :: i
287 complex, value
, optional
:: j
288 if (present (j
)) error
stop 42
291 subroutine two_all (i
, j
)
292 complex, intent(in
) :: i
293 complex, allocatable
,optional
:: j
294 if (present (j
)) error
stop 43
297 subroutine two_ptr (i
, j
)
298 complex, intent(in
) :: i
299 complex, pointer, optional
:: j
300 if (present (j
)) error
stop 44
305 ! Test suggested by Mikael Morin
308 integer, allocatable
:: c
309 integer, pointer :: p
=> NULL()
312 subroutine test_mm ()
323 integer, value
, optional
:: a
324 if (present(a
)) stop 1