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
|
! RUN: %python %S/test_symbols.py %s %flang_fc1
!DEF: /s1 (Subroutine) Subprogram
subroutine s1
implicit none
!DEF: /s1/x ObjectEntity REAL(8)
real(kind=8) :: x = 2.0
!DEF: /s1/a ObjectEntity INTEGER(4)
integer a
!DEF: /s1/t DerivedType
type :: t
end type
!REF: /s1/t
!DEF: /s1/z ALLOCATABLE ObjectEntity CLASS(t)
class(t), allocatable :: z
!DEF: /s1/OtherConstruct1/a AssocEntity REAL(8)
!REF: /s1/x
!DEF: /s1/OtherConstruct1/b AssocEntity REAL(8)
!DEF: /s1/OtherConstruct1/c AssocEntity CLASS(t)
!REF: /s1/z
associate (a => x, b => x+1, c => z)
!REF: /s1/x
!REF: /s1/OtherConstruct1/a
x = a
end associate
end subroutine
!DEF: /s2 (Subroutine) Subprogram
subroutine s2
!DEF: /s2/x ObjectEntity CHARACTER(4_4,1)
!DEF: /s2/y ObjectEntity CHARACTER(4_4,1)
character(len=4) x, y
!DEF: /s2/OtherConstruct1/z AssocEntity CHARACTER(4_8,1)
!REF: /s2/x
associate (z => x)
!REF: /s2/OtherConstruct1/z
print *, "z:", z
end associate
!TODO: need correct length for z
!DEF: /s2/OtherConstruct2/z AssocEntity CHARACTER(8_8,1)
!REF: /s2/x
!REF: /s2/y
associate (z => x//y)
!REF: /s2/OtherConstruct2/z
print *, "z:", z
end associate
end subroutine
!DEF: /s3 (Subroutine) Subprogram
subroutine s3
!DEF: /s3/t1 DerivedType
type :: t1
!DEF: /s3/t1/a1 ObjectEntity INTEGER(4)
integer :: a1
end type
!REF: /s3/t1
!DEF: /s3/t2 DerivedType
type, extends(t1) :: t2
!DEF: /s3/t2/a2 ObjectEntity INTEGER(4)
integer :: a2
end type
!DEF: /s3/i ObjectEntity INTEGER(4)
integer i
!REF: /s3/t1
!DEF: /s3/x POINTER ObjectEntity CLASS(t1)
class(t1), pointer :: x
!REF: /s3/x
select type (y => x)
!REF: /s3/t2
class is (t2)
!REF: /s3/i
!DEF: /s3/OtherConstruct1/y TARGET AssocEntity CLASS(t2)
!REF: /s3/t2/a2
i = y%a2
!REF: /s3/t1
type is (t1)
!REF: /s3/i
!DEF: /s3/OtherConstruct2/y TARGET AssocEntity TYPE(t1)
!REF: /s3/t1/a1
i = y%a1
class default
!DEF: /s3/OtherConstruct3/y TARGET AssocEntity CLASS(t1)
!REF:/s3/t1/a1
print *, y%a1
end select
end subroutine
!DEF: /s4 (Subroutine) Subprogram
subroutine s4
!DEF: /s4/t1 DerivedType
type :: t1
!DEF: /s4/t1/a ObjectEntity REAL(4)
real :: a
end type
!DEF: /s4/t2 DerivedType
type :: t2
!REF: /s4/t1
!DEF: /s4/t2/b ObjectEntity TYPE(t1)
type(t1) :: b
end type
!REF: /s4/t2
!DEF: /s4/x ObjectEntity TYPE(t2)
type(t2) :: x
!DEF: /s4/OtherConstruct1/y AssocEntity TYPE(t1)
!REF: /s4/x
!REF: /s4/t2/b
associate(y => x%b)
!REF: /s4/OtherConstruct1/y
!REF: /s4/t1/a
y%a = 0.0
end associate
end subroutine
!DEF: /s5 (Subroutine) Subprogram
subroutine s5
!DEF: /s5/t DerivedType
type :: t
!DEF: /s5/t/a ObjectEntity REAL(4)
real :: a
end type
!DEF: /s5/b ObjectEntity REAL(4)
real b
!DEF: /s5/OtherConstruct1/x AssocEntity TYPE(t)
!DEF: /s5/f (Function) Subprogram TYPE(t)
associate(x => f())
!REF: /s5/b
!REF: /s5/OtherConstruct1/x
!REF: /s5/t/a
b = x%a
end associate
contains
!REF: /s5/f
function f()
!REF: /s5/t
!DEF: /s5/f/f ObjectEntity TYPE(t)
type(t) :: f
end function
end subroutine
|