xref: /llvm-project/flang/test/Semantics/symbol32.f90 (revision fa6b574215377389258f019853a528c12706196d)
1! RUN: %python %S/test_symbols.py %s %flang_fc1
2! Test the executable part skimming for apparent calls, to ensure that
3! symbols in nested scopes (BLOCK, &c.) properly shadow host symbols.
4!DEF: /m Module
5module m
6end module
7!DEF: /subr (Subroutine) Subprogram
8!DEF: /subr/da INTENT(IN) ObjectEntity CLASS(*)
9!DEF: /subr/ar INTENT(IN) ObjectEntity REAL(4)
10subroutine subr (da, ar)
11 !REF: /subr/da
12 class(*), intent(in) :: da(:)
13 !REF: /subr/ar
14 real, intent(in) :: ar(..)
15 !DEF: /subr/s2 ObjectEntity REAL(4)
16 !DEF: /subr/s4 ObjectEntity REAL(4)
17 !DEF: /subr/s6 ObjectEntity REAL(4)
18 !DEF: /subr/s7 (Function) ProcEntity REAL(4)
19 !DEF: /subr/s8 ObjectEntity REAL(4)
20 real s2, s4, s6, s7, s8
21 !DEF: /s1 EXTERNAL (Function, Implicit) ProcEntity REAL(4)
22 print *, s1(1)
23 block
24  !DEF: /subr/BlockConstruct1/s2 ObjectEntity INTEGER(4)
25  !DEF: /subr/BlockConstruct1/s5 (Function) ProcEntity INTEGER(4)
26  integer s2(10), s5
27  !DEF: /subr/BlockConstruct1/s4 DerivedType
28  type :: s4
29   !DEF: /subr/BlockConstruct1/s4/n ObjectEntity INTEGER(4)
30   integer :: n
31  end type
32  !REF: /subr/BlockConstruct1/s2
33  print *, s2(1)
34  !DEF: /s3 EXTERNAL (Function, Implicit) ProcEntity REAL(4)
35  print *, s3(1)
36  !REF: /subr/BlockConstruct1/s4
37  print *, s4(1)
38  !REF: /subr/BlockConstruct1/s5
39  print *, s5(1)
40 end block
41 block
42  import, none
43  !DEF: /s2 EXTERNAL (Function, Implicit) ProcEntity REAL(4)
44  print *, s2(1)
45 end block
46 block
47  !REF: /subr/s6
48  import, only: s6
49  !DEF: /s8 EXTERNAL (Function, Implicit) ProcEntity REAL(4)
50  print *, s8(1)
51 end block
52 block
53  !REF: /m
54  use :: m
55  !REF: /subr/s7
56  print *, s7(1)
57 end block
58 !DEF: /subr/OtherConstruct1/s2 AssocEntity REAL(4)
59 associate (s2 => [1.])
60  !REF: /subr/OtherConstruct1/s2
61  print *, s2(1)
62 end associate
63 !REF: /subr/da
64 select type (s2 => da)
65 type is (real)
66  !DEF: /subr/OtherConstruct2/s2 AssocEntity REAL(4)
67  print *, s2(1)
68 end select
69 !REF: /subr/ar
70 select rank (s2 => ar)
71 rank (1)
72  !DEF: /subr/OtherConstruct3/s2 AssocEntity REAL(4)
73  print *, s2(1)
74 end select
75end subroutine
76