2020-05-12 02:38:53 +08:00
|
|
|
! RUN: %S/test_symbols.sh %s %t %f18
|
2019-09-13 14:03:06 +08:00
|
|
|
!DEF: /s1 (Subroutine) Subprogram
|
2019-01-16 08:59:20 +08:00
|
|
|
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/Block1/a AssocEntity REAL(8)
|
|
|
|
!REF: /s1/x
|
|
|
|
!DEF: /s1/Block1/b AssocEntity REAL(8)
|
|
|
|
!DEF: /s1/Block1/c AssocEntity CLASS(t)
|
|
|
|
!REF: /s1/z
|
|
|
|
associate (a => x, b => x+1, c => z)
|
|
|
|
!REF: /s1/x
|
|
|
|
!REF: /s1/Block1/a
|
|
|
|
x = a
|
|
|
|
end associate
|
|
|
|
end subroutine
|
|
|
|
|
2019-09-13 14:03:06 +08:00
|
|
|
!DEF: /s2 (Subroutine) Subprogram
|
2019-01-16 08:59:20 +08:00
|
|
|
subroutine s2
|
|
|
|
!DEF: /s2/x ObjectEntity CHARACTER(4_4,1)
|
|
|
|
!DEF: /s2/y ObjectEntity CHARACTER(4_4,1)
|
|
|
|
character(len=4) x, y
|
2019-07-24 01:55:56 +08:00
|
|
|
!DEF: /s2/Block1/z AssocEntity CHARACTER(4_8,1)
|
2019-01-16 08:59:20 +08:00
|
|
|
!REF: /s2/x
|
|
|
|
associate (z => x)
|
|
|
|
!REF: /s2/Block1/z
|
|
|
|
print *, "z:", z
|
|
|
|
end associate
|
|
|
|
!TODO: need correct length for z
|
2019-07-04 01:25:43 +08:00
|
|
|
!DEF: /s2/Block2/z AssocEntity CHARACTER(8_8,1)
|
2019-01-16 08:59:20 +08:00
|
|
|
!REF: /s2/x
|
|
|
|
!REF: /s2/y
|
|
|
|
associate (z => x//y)
|
|
|
|
!REF: /s2/Block2/z
|
|
|
|
print *, "z:", z
|
|
|
|
end associate
|
|
|
|
end subroutine
|
|
|
|
|
2019-09-13 14:03:06 +08:00
|
|
|
!DEF: /s3 (Subroutine) Subprogram
|
2019-01-16 08:59:20 +08:00
|
|
|
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/Block1/y TARGET AssocEntity TYPE(t2)
|
|
|
|
!REF: /s3/t2/a2
|
|
|
|
i = y%a2
|
2020-08-03 11:27:17 +08:00
|
|
|
!REF: /s3/t1
|
|
|
|
type is (t1)
|
2019-02-12 02:49:48 +08:00
|
|
|
!REF: /s3/i
|
2020-08-03 11:27:17 +08:00
|
|
|
!DEF: /s3/Block2/y TARGET AssocEntity TYPE(t1)
|
|
|
|
!REF: /s3/t1/a1
|
|
|
|
i = y%a1
|
2019-02-12 02:49:48 +08:00
|
|
|
class default
|
|
|
|
!DEF: /s3/Block3/y TARGET AssocEntity CLASS(t1)
|
|
|
|
print *, y
|
2019-01-16 08:59:20 +08:00
|
|
|
end select
|
|
|
|
end subroutine
|
2019-02-12 02:49:48 +08:00
|
|
|
|
2019-09-13 14:03:06 +08:00
|
|
|
!DEF: /s4 (Subroutine) Subprogram
|
2019-02-12 02:49:48 +08:00
|
|
|
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/Block1/y AssocEntity TYPE(t1)
|
|
|
|
!REF: /s4/x
|
|
|
|
!REF: /s4/t2/b
|
|
|
|
associate(y => x%b)
|
|
|
|
!REF: /s4/Block1/y
|
|
|
|
!REF: /s4/t1/a
|
|
|
|
y%a = 0.0
|
|
|
|
end associate
|
|
|
|
end subroutine
|
2019-05-06 22:26:43 +08:00
|
|
|
|
2019-09-13 14:03:06 +08:00
|
|
|
!DEF: /s5 (Subroutine) Subprogram
|
2019-05-06 22:26:43 +08:00
|
|
|
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/Block1/x AssocEntity TYPE(t)
|
2019-09-13 14:03:06 +08:00
|
|
|
!DEF: /s5/f (Function) Subprogram TYPE(t)
|
2019-05-06 22:26:43 +08:00
|
|
|
associate(x => f())
|
|
|
|
!REF: /s5/b
|
|
|
|
!REF: /s5/Block1/x
|
|
|
|
!REF: /s5/t/a
|
|
|
|
b = x%a
|
|
|
|
end associate
|
|
|
|
contains
|
2019-06-07 07:09:11 +08:00
|
|
|
!REF: /s5/f
|
2019-05-06 22:26:43 +08:00
|
|
|
function f()
|
|
|
|
!REF: /s5/t
|
2019-06-07 07:09:11 +08:00
|
|
|
!DEF: /s5/f/f ObjectEntity TYPE(t)
|
2019-05-06 22:26:43 +08:00
|
|
|
type(t) :: f
|
|
|
|
end function
|
|
|
|
end subroutine
|