1 ! RUN: %python %S/test_symbols.py %s %flang_fc1
2 ! Tests for "proc-interface" semantics.
3 ! These cases are all valid.
8 !DEF: /module1/abstract1 ABSTRACT, PUBLIC (Function) Subprogram REAL(4)
9 !DEF: /module1/abstract1/x INTENT(IN) ObjectEntity REAL(4)
10 real function abstract1(x
)
11 !REF: /module1/abstract1/x
13 end function abstract1
17 !DEF: /module1/explicit1 EXTERNAL, PUBLIC (Function) Subprogram REAL(4)
18 !DEF: /module1/explicit1/x INTENT(IN) ObjectEntity REAL(4)
19 real function explicit1(x
)
20 !REF: /module1/explicit1/x
22 end function explicit1
23 !DEF: /module1/logical EXTERNAL, PUBLIC (Function) Subprogram INTEGER(4)
24 !DEF: /module1/logical/x INTENT(IN) ObjectEntity REAL(4)
25 integer function logical(x
)
26 !REF: /module1/logical/x
29 !DEF: /module1/tan EXTERNAL, PUBLIC (Function) Subprogram CHARACTER(1_4,1)
30 !DEF: /module1/tan/x INTENT(IN) ObjectEntity REAL(4)
31 character(len
=1) function tan(x
)
37 !DEF: /module1/derived1 PUBLIC DerivedType
39 !REF: /module1/abstract1
40 !DEF: /module1/derived1/p1 NOPASS, POINTER (Function) ProcEntity REAL(4)
41 !DEF: /module1/nested1 PUBLIC (Function) Subprogram REAL(4)
42 procedure(abstract1
), pointer, nopass
:: p1
=> nested1
43 !REF: /module1/explicit1
44 !DEF: /module1/derived1/p2 NOPASS, POINTER (Function) ProcEntity REAL(4)
45 !REF: /module1/nested1
46 procedure(explicit1
), pointer, nopass
:: p2
=> nested1
47 !DEF: /module1/derived1/p3 NOPASS, POINTER (Function) ProcEntity LOGICAL(4)
48 !DEF: /module1/nested2 PUBLIC (Function) Subprogram LOGICAL(4)
49 procedure(logical), pointer, nopass
:: p3
=> nested2
50 !DEF: /module1/derived1/p4 NOPASS, POINTER (Function) ProcEntity LOGICAL(4)
51 !DEF: /module1/nested3 PUBLIC (Function) Subprogram LOGICAL(4)
52 procedure(logical(kind
=4)), pointer, nopass
:: p4
=> nested3
53 !DEF: /module1/derived1/p5 NOPASS, POINTER (Function) ProcEntity COMPLEX(4)
54 !DEF: /module1/nested4 PUBLIC (Function) Subprogram COMPLEX(4)
55 procedure(complex), pointer, nopass
:: p5
=> nested4
56 !DEF: /module1/sin ELEMENTAL, INTRINSIC, PUBLIC, PURE (Function) ProcEntity REAL(4)
57 !DEF: /module1/derived1/p6 NOPASS, POINTER (Function) ProcEntity REAL(4)
58 !REF: /module1/nested1
59 procedure(sin
), pointer, nopass
:: p6
=> nested1
61 !DEF: /module1/derived1/p7 NOPASS, POINTER (Function) ProcEntity REAL(4)
62 !DEF: /module1/cos ELEMENTAL, INTRINSIC, PUBLIC, PURE (Function) ProcEntity REAL(4)
63 procedure(sin
), pointer, nopass
:: p7
=> cos
65 !DEF: /module1/derived1/p8 NOPASS, POINTER (Function) ProcEntity CHARACTER(1_4,1)
66 !DEF: /module1/nested5 PUBLIC (Function) Subprogram CHARACTER(1_8,1)
67 procedure(tan
), pointer, nopass
:: p8
=> nested5
72 !REF: /module1/nested1
73 !DEF: /module1/nested1/x INTENT(IN) ObjectEntity REAL(4)
74 real function nested1(x
)
75 !REF: /module1/nested1/x
77 !DEF: /module1/nested1/nested1 ObjectEntity REAL(4)
78 !REF: /module1/nested1/x
82 !REF: /module1/nested2
83 !DEF: /module1/nested2/x INTENT(IN) ObjectEntity REAL(4)
84 logical function nested2(x
)
85 !REF: /module1/nested2/x
87 !DEF: /module1/nested2/nested2 ObjectEntity LOGICAL(4)
88 !REF: /module1/nested2/x
92 !REF: /module1/nested3
93 !DEF: /module1/nested3/x INTENT(IN) ObjectEntity REAL(4)
94 logical function nested3(x
)
95 !REF: /module1/nested3/x
97 !DEF: /module1/nested3/nested3 ObjectEntity LOGICAL(4)
98 !REF: /module1/nested3/x
102 !REF: /module1/nested4
103 !DEF: /module1/nested4/x INTENT(IN) ObjectEntity REAL(4)
104 complex function nested4(x
)
105 !REF: /module1/nested4/x
106 real, intent(in
) :: x
107 !DEF: /module1/nested4/nested4 ObjectEntity COMPLEX(4)
108 !DEF: /module1/nested4/cmplx ELEMENTAL, INTRINSIC, PURE (Function) ProcEntity
109 !REF: /module1/nested4/x
110 nested4
= cmplx(x
+4., 6.)
113 !REF: /module1/nested5
114 !DEF: /module1/nested5/x INTENT(IN) ObjectEntity REAL(4)
115 character function nested5(x
)
116 !REF: /module1/nested5/x
117 real, intent(in
) :: x
118 !DEF: /module1/nested5/nested5 ObjectEntity CHARACTER(1_8,1)
123 !DEF: /explicit1 ELEMENTAL (Function) Subprogram REAL(4)
124 !DEF: /explicit1/x INTENT(IN) ObjectEntity REAL(4)
125 real elemental
function explicit1(x
)
127 real, intent(in
) :: x
128 !DEF: /explicit1/explicit1 ObjectEntity REAL(4)
131 end function explicit1
133 !DEF: /logical (Function) Subprogram INTEGER(4)
134 !DEF: /logical/x INTENT(IN) ObjectEntity REAL(4)
135 integer function logical(x
)
137 real, intent(in
) :: x
138 !DEF: /logical/logical ObjectEntity INTEGER(4)
143 !DEF: /tan (Function) Subprogram REAL(4)
144 !DEF: /tan/x INTENT(IN) ObjectEntity REAL(4)
147 real, intent(in
) :: x
148 !DEF: /tan/tan ObjectEntity REAL(4)
153 !DEF: /main MainProgram
157 !DEF: /main/derived1 Use
158 !DEF: /main/instance ObjectEntity TYPE(derived1)
159 type(derived1
) :: instance
161 !REF: /module1/derived1/p1
162 if (instance
%p1(1.)/=2.) print *, "p1 failed"
164 !REF: /module1/derived1/p2
165 if (instance
%p2(1.)/=2.) print *, "p2 failed"
167 !REF: /module1/derived1/p3
168 if (.not
.instance
%p3(1.)) print *, "p3 failed"
170 !REF: /module1/derived1/p4
171 if (.not
.instance
%p4(1.)) print *, "p4 failed"
173 !REF: /module1/derived1/p5
174 if (instance
%p5(1.)/=(5.,6.)) print *, "p5 failed"
176 !REF: /module1/derived1/p6
177 if (instance
%p6(1.)/=2.) print *, "p6 failed"
179 !REF: /module1/derived1/p7
180 if (instance
%p7(0.)/=1.) print *, "p7 failed"
182 !REF: /module1/derived1/p8
183 if (instance
%p8(1.)/="a") print *, "p8 failed"