Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / symbol20.f90
blob8c827769333211e2ce58f5b9bd41b4065a6097a9
1 ! RUN: %python %S/test_symbols.py %s %flang_fc1
2 ! Test handling of pernicious case in which it is conformant Fortran
3 ! to use the name of a function in a CALL statement. Almost all
4 ! other compilers produce bogus errors for this case and/or crash.
6 !DEF: /m Module
7 module m
8 contains
9 !DEF: /m/foo PUBLIC (Function) Subprogram
10 function foo()
11 !DEF: /m/bar PUBLIC (Subroutine) Subprogram
12 !DEF: /m/foo/foo EXTERNAL, POINTER (Subroutine) ProcEntity
13 procedure(bar), pointer :: foo
14 !REF: /m/bar
15 !DEF: /m/foo/baz EXTERNAL, POINTER (Subroutine) ProcEntity
16 procedure(bar), pointer :: baz
17 !REF: /m/foo/foo
18 !REF: /m/bar
19 foo => bar
20 !REF: /m/foo/foo
21 call foo
22 !DEF: /m/baz PUBLIC (Function) Subprogram
23 entry baz()
24 !REF: /m/foo/baz
25 !REF: /m/bar
26 baz => bar
27 !REF: /m/foo/baz
28 call baz
29 end function
30 !REF: /m/bar
31 subroutine bar
32 print *, "in bar"
33 end subroutine
34 end module
35 !DEF: /demo MainProgram
36 program demo
37 !REF: /m
38 use :: m
39 !DEF: /demo/bar (Subroutine) Use
40 !DEF: /demo/p EXTERNAL, POINTER (Subroutine) ProcEntity
41 procedure(bar), pointer :: p
42 !REF: /demo/p
43 !DEF: /demo/foo (Function) Use
44 p => foo()
45 !REF: /demo/p
46 call p
47 end program