Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / symbol19.f90
blob541c5ccbf946883148b1ad82bc12a9e2db4c74e2
1 ! RUN: %python %S/test_symbols.py %s %flang_fc1
3 ! Test that a procedure is only implicitly resolved as an intrinsic function
4 ! (resp. subroutine) if this is a function (resp. subroutine)
6 !DEF: /expect_external (Subroutine) Subprogram
7 subroutine expect_external
8 !DEF: /acos EXTERNAL (Subroutine) ProcEntity
9 !DEF: /expect_external/x (Implicit) ObjectEntity REAL(4)
10 call acos(x)
11 !DEF: /expect_external/i (Implicit) ObjectEntity INTEGER(4)
12 !DEF: /system_clock EXTERNAL (Function, Implicit) ProcEntity REAL(4)
13 !DEF: /expect_external/icount (Implicit) ObjectEntity INTEGER(4)
14 i = system_clock(icount)
15 end subroutine
17 !DEF: /expect_intrinsic (Subroutine) Subprogram
18 subroutine expect_intrinsic
19 !DEF: /expect_intrinsic/y (Implicit) ObjectEntity REAL(4)
20 !DEF: /expect_intrinsic/acos ELEMENTAL, INTRINSIC, PURE (Function) ProcEntity
21 !DEF: /expect_intrinsic/x (Implicit) ObjectEntity REAL(4)
22 y = acos(x)
23 !DEF: /expect_intrinsic/system_clock INTRINSIC (Subroutine) ProcEntity
24 !DEF: /expect_intrinsic/icount (Implicit) ObjectEntity INTEGER(4)
25 call system_clock(icount)
26 end subroutine
28 ! Sanity check that the EXTERNAL attribute is not bypassed by
29 ! implicit intrinsic resolution, even if it otherwise perfectly
30 ! matches an intrinsic call.
32 !DEF: /expect_external_2 (Subroutine) Subprogram
33 subroutine expect_external_2
34 !DEF: /expect_external_2/matmul EXTERNAL (Function, Implicit) ProcEntity INTEGER(4)
35 external :: matmul
36 !DEF: /expect_external_2/cpu_time EXTERNAL (Subroutine) ProcEntity
37 external :: cpu_time
38 !DEF: /expect_external_2/x ObjectEntity REAL(4)
39 !DEF: /expect_external_2/y ObjectEntity REAL(4)
40 !DEF: /expect_external_2/z ObjectEntity REAL(4)
41 !DEF: /expect_external_2/t ObjectEntity REAL(4)
42 real x(2,2), y(2), z(2), t
43 !REF: /expect_external_2/z
44 !REF: /expect_external_2/matmul
45 !REF: /expect_external_2/x
46 !REF: /expect_external_2/y
47 z = matmul(x, y)
48 !REF: /expect_external_2/cpu_time
49 !REF: /expect_external_2/t
50 call cpu_time(t)
51 end subroutine