1! RUN: %S/test_symbols.sh %s %t %f18
2!DEF: /s1 (Subroutine) Subprogram
3subroutine s1
4 implicit none
5 !DEF: /s1/x ObjectEntity REAL(8)
6 real(kind=8) :: x = 2.0
7 !DEF: /s1/a ObjectEntity INTEGER(4)
8 integer a
9 !DEF: /s1/t DerivedType
10 type :: t
11 end type
12 !REF: /s1/t
13 !DEF: /s1/z ALLOCATABLE ObjectEntity CLASS(t)
14 class(t), allocatable :: z
15 !DEF: /s1/Block1/a AssocEntity REAL(8)
16 !REF: /s1/x
17 !DEF: /s1/Block1/b AssocEntity REAL(8)
18 !DEF: /s1/Block1/c AssocEntity CLASS(t)
19 !REF: /s1/z
20 associate (a => x, b => x+1, c => z)
21  !REF: /s1/x
22  !REF: /s1/Block1/a
23  x = a
24 end associate
25end subroutine
26
27!DEF: /s2 (Subroutine) Subprogram
28subroutine s2
29 !DEF: /s2/x ObjectEntity CHARACTER(4_4,1)
30 !DEF: /s2/y ObjectEntity CHARACTER(4_4,1)
31 character(len=4) x, y
32 !DEF: /s2/Block1/z AssocEntity CHARACTER(4_8,1)
33 !REF: /s2/x
34 associate (z => x)
35  !REF: /s2/Block1/z
36  print *, "z:", z
37 end associate
38 !TODO: need correct length for z
39 !DEF: /s2/Block2/z AssocEntity CHARACTER(8_8,1)
40 !REF: /s2/x
41 !REF: /s2/y
42 associate (z => x//y)
43  !REF: /s2/Block2/z
44  print *, "z:", z
45 end associate
46end subroutine
47
48!DEF: /s3 (Subroutine) Subprogram
49subroutine s3
50 !DEF: /s3/t1 DerivedType
51 type :: t1
52  !DEF: /s3/t1/a1 ObjectEntity INTEGER(4)
53  integer :: a1
54 end type
55 !REF: /s3/t1
56 !DEF: /s3/t2 DerivedType
57 type, extends(t1) :: t2
58  !DEF: /s3/t2/a2 ObjectEntity INTEGER(4)
59  integer :: a2
60 end type
61 !DEF: /s3/i ObjectEntity INTEGER(4)
62 integer i
63 !REF: /s3/t1
64 !DEF: /s3/x POINTER ObjectEntity CLASS(t1)
65 class(t1), pointer :: x
66 !REF: /s3/x
67 select type (y => x)
68  !REF: /s3/t2
69  class is (t2)
70   !REF: /s3/i
71   !DEF: /s3/Block1/y TARGET AssocEntity TYPE(t2)
72   !REF: /s3/t2/a2
73   i = y%a2
74  !REF: /s3/t1
75  type is (t1)
76   !REF: /s3/i
77   !DEF: /s3/Block2/y TARGET AssocEntity TYPE(t1)
78   !REF: /s3/t1/a1
79   i = y%a1
80  class default
81   !DEF: /s3/Block3/y TARGET AssocEntity CLASS(t1)
82   print *, y
83 end select
84end subroutine
85
86!DEF: /s4 (Subroutine) Subprogram
87subroutine s4
88 !DEF: /s4/t1 DerivedType
89 type :: t1
90  !DEF: /s4/t1/a ObjectEntity REAL(4)
91  real :: a
92 end type
93 !DEF: /s4/t2 DerivedType
94 type :: t2
95  !REF: /s4/t1
96  !DEF: /s4/t2/b ObjectEntity TYPE(t1)
97  type(t1) :: b
98 end type
99 !REF: /s4/t2
100 !DEF: /s4/x ObjectEntity TYPE(t2)
101 type(t2) :: x
102 !DEF: /s4/Block1/y AssocEntity TYPE(t1)
103 !REF: /s4/x
104 !REF: /s4/t2/b
105 associate(y => x%b)
106  !REF: /s4/Block1/y
107  !REF: /s4/t1/a
108  y%a = 0.0
109 end associate
110end subroutine
111
112!DEF: /s5 (Subroutine) Subprogram
113subroutine s5
114 !DEF: /s5/t DerivedType
115 type :: t
116  !DEF: /s5/t/a ObjectEntity REAL(4)
117  real :: a
118 end type
119 !DEF: /s5/b ObjectEntity REAL(4)
120 real b
121 !DEF: /s5/Block1/x AssocEntity TYPE(t)
122 !DEF: /s5/f (Function) Subprogram TYPE(t)
123 associate(x => f())
124  !REF: /s5/b
125  !REF: /s5/Block1/x
126  !REF: /s5/t/a
127  b = x%a
128 end associate
129contains
130 !REF: /s5/f
131 function f()
132  !REF: /s5/t
133  !DEF: /s5/f/f ObjectEntity TYPE(t)
134  type(t) :: f
135 end function
136end subroutine
137