1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
! RUN: %S/test_symbols.sh %s %t %f18
! Tests for "proc-interface" semantics.
! These cases are all valid.
!DEF: /module1 Module
module module1
abstract interface
!DEF: /module1/abstract1 ABSTRACT, PUBLIC (Function) Subprogram REAL(4)
!DEF: /module1/abstract1/x INTENT(IN) ObjectEntity REAL(4)
real function abstract1(x)
!REF: /module1/abstract1/x
real, intent(in) :: x
end function abstract1
end interface
interface
!DEF: /module1/explicit1 EXTERNAL, PUBLIC (Function) Subprogram REAL(4)
!DEF: /module1/explicit1/x INTENT(IN) ObjectEntity REAL(4)
real function explicit1(x)
!REF: /module1/explicit1/x
real, intent(in) :: x
end function explicit1
!DEF: /module1/logical EXTERNAL, PUBLIC (Function) Subprogram INTEGER(4)
!DEF: /module1/logical/x INTENT(IN) ObjectEntity REAL(4)
integer function logical(x)
!REF: /module1/logical/x
real, intent(in) :: x
end function logical
!DEF: /module1/tan EXTERNAL, PUBLIC (Function) Subprogram CHARACTER(1_4,1)
!DEF: /module1/tan/x INTENT(IN) ObjectEntity REAL(4)
character(len=1) function tan(x)
!REF: /module1/tan/x
real, intent(in) :: x
end function tan
end interface
!DEF: /module1/derived1 PUBLIC DerivedType
type :: derived1
!REF: /module1/abstract1
!DEF: /module1/derived1/p1 NOPASS, POINTER (Function) ProcEntity REAL(4)
!DEF: /module1/nested1 PUBLIC (Function) Subprogram REAL(4)
procedure(abstract1), pointer, nopass :: p1 => nested1
!REF: /module1/explicit1
!DEF: /module1/derived1/p2 NOPASS, POINTER (Function) ProcEntity REAL(4)
!REF: /module1/nested1
procedure(explicit1), pointer, nopass :: p2 => nested1
!DEF: /module1/derived1/p3 NOPASS, POINTER (Function) ProcEntity LOGICAL(4)
!DEF: /module1/nested2 PUBLIC (Function) Subprogram LOGICAL(4)
procedure(logical), pointer, nopass :: p3 => nested2
!DEF: /module1/derived1/p4 NOPASS, POINTER (Function) ProcEntity LOGICAL(4)
!DEF: /module1/nested3 PUBLIC (Function) Subprogram LOGICAL(4)
procedure(logical(kind=4)), pointer, nopass :: p4 => nested3
!DEF: /module1/derived1/p5 NOPASS, POINTER (Function) ProcEntity COMPLEX(4)
!DEF: /module1/nested4 PUBLIC (Function) Subprogram COMPLEX(4)
procedure(complex), pointer, nopass :: p5 => nested4
!DEF: /module1/sin ELEMENTAL, INTRINSIC, PUBLIC, PURE (Function) ProcEntity
!DEF: /module1/derived1/p6 NOPASS, POINTER (Function) ProcEntity
!REF: /module1/nested1
procedure(sin), pointer, nopass :: p6 => nested1
!REF: /module1/sin
!DEF: /module1/derived1/p7 NOPASS, POINTER (Function) ProcEntity
!DEF: /module1/cos ELEMENTAL, INTRINSIC, PUBLIC, PURE (Function) ProcEntity
procedure(sin), pointer, nopass :: p7 => cos
!REF: /module1/tan
!DEF: /module1/derived1/p8 NOPASS, POINTER (Function) ProcEntity CHARACTER(1_4,1)
!DEF: /module1/nested5 PUBLIC (Function) Subprogram CHARACTER(1_8,1)
procedure(tan), pointer, nopass :: p8 => nested5
end type derived1
contains
!REF: /module1/nested1
!DEF: /module1/nested1/x INTENT(IN) ObjectEntity REAL(4)
real function nested1(x)
!REF: /module1/nested1/x
real, intent(in) :: x
!DEF: /module1/nested1/nested1 ObjectEntity REAL(4)
!REF: /module1/nested1/x
nested1 = x+1.
end function nested1
!REF: /module1/nested2
!DEF: /module1/nested2/x INTENT(IN) ObjectEntity REAL(4)
logical function nested2(x)
!REF: /module1/nested2/x
real, intent(in) :: x
!DEF: /module1/nested2/nested2 ObjectEntity LOGICAL(4)
!REF: /module1/nested2/x
nested2 = x/=0
end function nested2
!REF: /module1/nested3
!DEF: /module1/nested3/x INTENT(IN) ObjectEntity REAL(4)
logical function nested3(x)
!REF: /module1/nested3/x
real, intent(in) :: x
!DEF: /module1/nested3/nested3 ObjectEntity LOGICAL(4)
!REF: /module1/nested3/x
nested3 = x>0
end function nested3
!REF: /module1/nested4
!DEF: /module1/nested4/x INTENT(IN) ObjectEntity REAL(4)
complex function nested4(x)
!REF: /module1/nested4/x
real, intent(in) :: x
!DEF: /module1/nested4/nested4 ObjectEntity COMPLEX(4)
!DEF: /module1/nested4/cmplx ELEMENTAL, INTRINSIC, PURE (Function) ProcEntity
!REF: /module1/nested4/x
nested4 = cmplx(x+4., 6.)
end function nested4
!REF: /module1/nested5
!DEF: /module1/nested5/x INTENT(IN) ObjectEntity REAL(4)
character function nested5(x)
!REF: /module1/nested5/x
real, intent(in) :: x
!DEF: /module1/nested5/nested5 ObjectEntity CHARACTER(1_8,1)
nested5 = "a"
end function nested5
end module module1
!DEF: /explicit1 ELEMENTAL (Function) Subprogram REAL(4)
!DEF: /explicit1/x INTENT(IN) ObjectEntity REAL(4)
real elemental function explicit1(x)
!REF: /explicit1/x
real, intent(in) :: x
!DEF: /explicit1/explicit1 ObjectEntity REAL(4)
!REF: /explicit1/x
explicit1 = -x
end function explicit1
!DEF: /logical (Function) Subprogram INTEGER(4)
!DEF: /logical/x INTENT(IN) ObjectEntity REAL(4)
integer function logical(x)
!REF: /logical/x
real, intent(in) :: x
!DEF: /logical/logical ObjectEntity INTEGER(4)
!REF: /logical/x
logical = x+3.
end function logical
!DEF: /tan (Function) Subprogram REAL(4)
!DEF: /tan/x INTENT(IN) ObjectEntity REAL(4)
real function tan(x)
!REF: /tan/x
real, intent(in) :: x
!DEF: /tan/tan ObjectEntity REAL(4)
!REF: /tan/x
tan = x+5.
end function tan
!DEF: /main MainProgram
program main
!REF: /module1
use :: module1
!DEF: /main/derived1 Use
!DEF: /main/instance ObjectEntity TYPE(derived1)
type(derived1) :: instance
!REF: /main/instance
!REF: /module1/derived1/p1
if (instance%p1(1.)/=2.) print *, "p1 failed"
!REF: /main/instance
!REF: /module1/derived1/p2
if (instance%p2(1.)/=2.) print *, "p2 failed"
!REF: /main/instance
!REF: /module1/derived1/p3
if (.not.instance%p3(1.)) print *, "p3 failed"
!REF: /main/instance
!REF: /module1/derived1/p4
if (.not.instance%p4(1.)) print *, "p4 failed"
!REF: /main/instance
!REF: /module1/derived1/p5
if (instance%p5(1.)/=(5.,6.)) print *, "p5 failed"
!REF: /main/instance
!REF: /module1/derived1/p6
if (instance%p6(1.)/=2.) print *, "p6 failed"
!REF: /main/instance
!REF: /module1/derived1/p7
if (instance%p7(0.)/=1.) print *, "p7 failed"
!REF: /main/instance
!REF: /module1/derived1/p8
if (instance%p8(1.)/="a") print *, "p8 failed"
end program main
|