1 !RUN: %flang_fc1 -fdebug-dump-symbols %s | FileCheck %s
6 type(pdt2(k1
,l1
)), allocatable
:: a1
12 type(pdt1(k2
,l2
)) :: a2(k2
)
15 module function mf(n
,str
,x1
) result(res
)
16 integer, intent(in
) :: n
17 character(n
), intent(in
) :: str
18 type(pdt1(1,n
)), intent(in
) :: x1
19 type(pdt2(2,n
)) :: res
21 module subroutine ms(f
)
26 !CHECK: mf, MODULE, PUBLIC (Function): Subprogram isInterface result:TYPE(pdt2(k2=2_4,l2=n)) res (INTEGER(4) n,CHARACTER(n,1) str,TYPE(pdt1(k1=1_4,l1=n)) x1)
27 !CHECK: pdt1, PUBLIC: DerivedType components: a1
28 !CHECK: pdt2, PUBLIC: DerivedType components: j2,a2
29 !CHECK: sm: Module (m)
30 !CHECK: DerivedType scope: pdt1
31 !CHECK: a1, ALLOCATABLE: ObjectEntity type: TYPE(pdt2(int(k1,kind=4),int(l1,kind=4)))
32 !CHECK: k1: TypeParam type:INTEGER(4) Kind
33 !CHECK: l1: TypeParam type:INTEGER(4) Len
34 !CHECK: DerivedType scope: pdt2
35 !CHECK: a2: ObjectEntity type: TYPE(pdt1(k1=int(k2,kind=4),l1=int(l2,kind=4))) shape: 1_8:k2
36 !CHECK: j2: ObjectEntity type: INTEGER(int(int(k2,kind=4),kind=8))
37 !CHECK: k2: TypeParam type:INTEGER(4) Kind
38 !CHECK: l2: TypeParam type:INTEGER(4) Len
39 !CHECK: Subprogram scope: mf size=112 alignment=8
40 !CHECK: mf (Function): HostAssoc
41 !CHECK: n, INTENT(IN) size=4 offset=0: ObjectEntity dummy type: INTEGER(4)
42 !CHECK: res size=40 offset=72: ObjectEntity funcResult type: TYPE(pdt2(k2=2_4,l2=n))
43 !CHECK: str, INTENT(IN) size=24 offset=8: ObjectEntity dummy type: CHARACTER(n,1)
44 !CHECK: x1, INTENT(IN) size=40 offset=32: ObjectEntity dummy type: TYPE(pdt1(k1=1_4,l1=n))
45 !CHECK: DerivedType scope: size=40 alignment=8 instantiation of pdt1(k1=1_4,l1=n)
46 !CHECK: a1, ALLOCATABLE size=40 offset=0: ObjectEntity type: TYPE(pdt2(k2=1_4,l2=int(l1,kind=4)))
47 !CHECK: k1: TypeParam type:INTEGER(4) Kind init:1_4
48 !CHECK: l1: TypeParam type:INTEGER(4) Len init:n
49 !CHECK: DerivedType scope: size=72 alignment=8 instantiation of pdt2(k2=1_4,l2=int(l1,kind=4))
50 !CHECK: a2 size=64 offset=8: ObjectEntity type: TYPE(pdt1(k1=1_4,l1=int(l2,kind=4))) shape: 1_8:1_8
51 !CHECK: j2 size=1 offset=0: ObjectEntity type: INTEGER(1)
52 !CHECK: k2: TypeParam type:INTEGER(4) Kind init:1_4
53 !CHECK: l2: TypeParam type:INTEGER(4) Len init:int(l1,kind=4)
54 !CHECK: DerivedType scope: size=40 alignment=8 instantiation of pdt1(k1=1_4,l1=int(l2,kind=4))
55 !CHECK: a1, ALLOCATABLE size=40 offset=0: ObjectEntity type: TYPE(pdt2(k2=1_4,l2=int(l1,kind=4)))
56 !CHECK: k1: TypeParam type:INTEGER(4) Kind init:1_4
57 !CHECK: l1: TypeParam type:INTEGER(4) Len init:int(l2,kind=4)
58 !CHECK: DerivedType scope: size=72 alignment=8 instantiation of pdt2(k2=2_4,l2=n)
59 !CHECK: a2 size=64 offset=8: ObjectEntity type: TYPE(pdt1(k1=2_4,l1=int(l2,kind=4))) shape: 1_8:2_8
60 !CHECK: j2 size=2 offset=0: ObjectEntity type: INTEGER(2)
61 !CHECK: k2: TypeParam type:INTEGER(4) Kind init:2_4
62 !CHECK: l2: TypeParam type:INTEGER(4) Len init:n
63 !CHECK: DerivedType scope: size=40 alignment=8 instantiation of pdt1(k1=2_4,l1=int(l2,kind=4))
64 !CHECK: a1, ALLOCATABLE size=40 offset=0: ObjectEntity type: TYPE(pdt2(k2=2_4,l2=int(l1,kind=4)))
65 !CHECK: k1: TypeParam type:INTEGER(4) Kind init:2_4
66 !CHECK: l1: TypeParam type:INTEGER(4) Len init:int(l2,kind=4)
67 !CHECK: DerivedType scope: size=72 alignment=8 instantiation of pdt2(k2=2_4,l2=int(l1,kind=4))
68 !CHECK: a2 size=64 offset=8: ObjectEntity type: TYPE(pdt1(k1=2_4,l1=int(l2,kind=4))) shape: 1_8:2_8
69 !CHECK: j2 size=2 offset=0: ObjectEntity type: INTEGER(2)
70 !CHECK: k2: TypeParam type:INTEGER(4) Kind init:2_4
71 !CHECK: l2: TypeParam type:INTEGER(4) Len init:int(l1,kind=4)
76 print *, len(str
), x1
%k1
, x1
%l1
, res
%k2
, res
%l2
77 allocate(res
%a2(1)%a1
)
82 ! x = f(3, "abc", pdt1(1,3)())
85 !CHECK: Module scope: sm size=0 alignment=1
86 !CHECK: mf, MODULE, PUBLIC (Function): Subprogram result:TYPE(pdt2(k2=2_4,l2=n)) res (INTEGER(4) n,CHARACTER(n,1) str,TYPE(pdt1(k1=1_4,l1=n)) x1) moduleInterface: mf, MODULE, PUBLIC (Function): Subprogram isInterface result:TYPE(pdt2(k2=2_4,l2=n)) res (INTEGER(4) n,CHARACTER(n,1) str,TYPE(pdt1(k1=1_4,l1=n)) x1)
87 !CHECK: Subprogram scope: mf size=112 alignment=8
88 !CHECK: len, INTRINSIC, PURE (Function): ProcEntity
89 !CHECK: n, INTENT(IN) size=4 offset=0: ObjectEntity dummy type: INTEGER(4)
90 !CHECK: res size=40 offset=72: ObjectEntity funcResult type: TYPE(pdt2(k2=2_4,l2=n))
91 !CHECK: str, INTENT(IN) size=24 offset=8: ObjectEntity dummy type: CHARACTER(n,1)
92 !CHECK: x1, INTENT(IN) size=40 offset=32: ObjectEntity dummy type: TYPE(pdt1(k1=1_4,l1=n))
93 !CHECK: DerivedType scope: size=72 alignment=8 instantiation of pdt2(k2=2_4,l2=n)
94 !CHECK: a2 size=64 offset=8: ObjectEntity type: TYPE(pdt1(k1=2_4,l1=int(l2,kind=4))) shape: 1_8:2_8
95 !CHECK: j2 size=2 offset=0: ObjectEntity type: INTEGER(2)
96 !CHECK: k2: TypeParam type:INTEGER(4) Kind init:2_4
97 !CHECK: l2: TypeParam type:INTEGER(4) Len init:n
98 !CHECK: DerivedType scope: size=40 alignment=8 instantiation of pdt1(k1=2_4,l1=int(l2,kind=4))
99 !CHECK: a1, ALLOCATABLE size=40 offset=0: ObjectEntity type: TYPE(pdt2(k2=2_4,l2=int(l1,kind=4)))
100 !CHECK: k1: TypeParam type:INTEGER(4) Kind init:2_4
101 !CHECK: l1: TypeParam type:INTEGER(4) Len init:int(l2,kind=4)
102 !CHECK: DerivedType scope: size=72 alignment=8 instantiation of pdt2(k2=2_4,l2=int(l1,kind=4))
103 !CHECK: a2 size=64 offset=8: ObjectEntity type: TYPE(pdt1(k1=2_4,l1=int(l2,kind=4))) shape: 1_8:2_8
104 !CHECK: j2 size=2 offset=0: ObjectEntity type: INTEGER(2)
105 !CHECK: k2: TypeParam type:INTEGER(4) Kind init:2_4
106 !CHECK: l2: TypeParam type:INTEGER(4) Len init:int(l1,kind=4)
107 !CHECK: DerivedType scope: size=40 alignment=8 instantiation of pdt1(k1=1_4,l1=n)
108 !CHECK: a1, ALLOCATABLE size=40 offset=0: ObjectEntity type: TYPE(pdt2(k2=1_4,l2=int(l1,kind=4)))
109 !CHECK: k1: TypeParam type:INTEGER(4) Kind init:1_4
110 !CHECK: l1: TypeParam type:INTEGER(4) Len init:n
111 !CHECK: DerivedType scope: size=72 alignment=8 instantiation of pdt2(k2=1_4,l2=int(l1,kind=4))
112 !CHECK: a2 size=64 offset=8: ObjectEntity type: TYPE(pdt1(k1=1_4,l1=int(l2,kind=4))) shape: 1_8:1_8
113 !CHECK: j2 size=1 offset=0: ObjectEntity type: INTEGER(1)
114 !CHECK: k2: TypeParam type:INTEGER(4) Kind init:1_4
115 !CHECK: l2: TypeParam type:INTEGER(4) Len init:int(l1,kind=4)
116 !CHECK: DerivedType scope: size=40 alignment=8 instantiation of pdt1(k1=1_4,l1=int(l2,kind=4))
117 !CHECK: a1, ALLOCATABLE size=40 offset=0: ObjectEntity type: TYPE(pdt2(k2=1_4,l2=int(l1,kind=4)))
118 !CHECK: k1: TypeParam type:INTEGER(4) Kind init:1_4
119 !CHECK: l1: TypeParam type:INTEGER(4) Len init:int(l2,kind=4)
124 x
= mf(3, "abc", pdt1(1,3)())
127 !CHECK: MainProgram scope: test size=88 alignment=8
128 !CHECK: mf, MODULE (Function): Use from mf in m
129 !CHECK: pdt1: Use from pdt1 in m
130 !CHECK: pdt2: Use from pdt2 in m
131 !CHECK: x size=88 offset=0: ObjectEntity type: TYPE(pdt2(k2=2_4,l2=3_4))
132 !CHECK: DerivedType scope: size=88 alignment=8 instantiation of pdt2(k2=2_4,l2=3_4)
133 !CHECK: a2 size=80 offset=8: ObjectEntity type: TYPE(pdt1(k1=2_4,l1=3_4)) shape: 1_8:2_8
134 !CHECK: j2 size=2 offset=0: ObjectEntity type: INTEGER(2)
135 !CHECK: k2: TypeParam type:INTEGER(4) Kind init:2_4
136 !CHECK: l2: TypeParam type:INTEGER(4) Len init:3_4
137 !CHECK: DerivedType scope: size=40 alignment=8 instantiation of pdt1(k1=2_4,l1=3_4)
138 !CHECK: a1, ALLOCATABLE size=40 offset=0: ObjectEntity type: TYPE(pdt2(k2=2_4,l2=3_4))
139 !CHECK: k1: TypeParam type:INTEGER(4) Kind init:2_4
140 !CHECK: l1: TypeParam type:INTEGER(4) Len init:3_4
141 !CHECK: DerivedType scope: size=40 alignment=8 instantiation of pdt1(k1=1_4,l1=3_4)
142 !CHECK: a1, ALLOCATABLE size=40 offset=0: ObjectEntity type: TYPE(pdt2(k2=1_4,l2=3_4))
143 !CHECK: k1: TypeParam type:INTEGER(4) Kind init:1_4
144 !CHECK: l1: TypeParam type:INTEGER(4) Len init:3_4
145 !CHECK: DerivedType scope: size=1 alignment=1 instantiation of pdt2(k2=1_4,l2=3_4)
146 !CHECK: a2: ObjectEntity type: TYPE(pdt1(k1=1_4,l1=3_4)) shape: 1_8:1_8
147 !CHECK: j2 size=1 offset=0: ObjectEntity type: INTEGER(1)
148 !CHECK: k2: TypeParam type:INTEGER(4) Kind init:1_4
149 !CHECK: l2: TypeParam type:INTEGER(4) Len init:3_4