1 ! Program to test STATEMENT function
4 call with_function_call
5 call with_character_dummy
6 call with_derived_type_dummy
7 call with_pointer_dummy
11 subroutine simple_case
17 if (st1 (1, 2) .ne
. 3) call abort
19 if (st2 (1, 2) .ne
. 3 .or
. st2 (2, 3) .ne
. 3) call abort
22 subroutine with_function_call
24 st3 (i
, j
) = fun (i
) + fun (j
)
26 if (st3 (fun (2), 4) .ne
. 16) call abort
29 subroutine with_character_dummy
30 character (len
=4) s1
, s2
, st4
31 character (len
=10) st5
, s0
32 st4 (i
, j
) = "0123456789"(i
:j
)
33 st5 (s1
, s2
) = s1
// s2
35 if (st4 (1, 4) .ne
. "0123" ) call abort
36 if (st5 ("01", "02") .ne
. "01 02 ") call abort
! { dg-warning "Character length of actual argument shorter" }
39 subroutine with_derived_type_dummy
42 character (len
=50) name
44 type (person
) me
, p
, tom
51 if (tom
%age
.ne
. 5) call abort
52 if (tom
%name
.gt
. "Tom") call abort
55 subroutine with_pointer_dummy
56 character(len
=4), pointer:: p
, p1
57 character(len
=4), target
:: i
63 if (a (p1
) .ne
. '123410') call abort
66 subroutine multiple_eval
67 integer st7
, fun2
, fun
71 if (st7(fun2(10)) .ne
. 3) call abort
75 ! This functon returns the argument passed on the previous call.
76 integer function fun2 (i
)
78 integer, save :: val
= 1
84 integer function fun (i
)