Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / call24.f90
blob7d2ba9ff80d40186f536a4ecb72b4b85b1c82fbe
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! 15.4.2.2. Test that errors are reported when an explicit interface
3 ! is not provided for an external procedure that requires an explicit
4 ! interface (the definition needs to be visible so that the compiler
5 ! can detect the violation).
7 subroutine foo(a_pointer)
8 real, pointer :: a_pointer(:)
9 end subroutine
11 subroutine bar(a_pointer)
12 procedure(real), pointer :: a_pointer
13 end subroutine
15 subroutine baz(proc)
16 external :: proc
17 real, optional :: proc
18 end subroutine
20 subroutine test()
21 real, pointer :: a_pointer(:)
22 real, pointer :: an_array(:)
23 intrinsic :: sin
25 ! This call would be allowed if the interface was explicit here,
26 ! but its handling with an implicit interface is different (no
27 ! descriptor involved, copy-in/copy-out...)
29 !ERROR: References to the procedure 'foo' require an explicit interface
30 call foo(a_pointer)
32 ! This call would be error if the interface was explicit here.
34 !ERROR: References to the procedure 'foo' require an explicit interface
35 call foo(an_array)
37 !ERROR: References to the procedure 'bar' require an explicit interface
38 !WARNING: If the procedure's interface were explicit, this reference would be in error
39 !BECAUSE: Actual argument associated with procedure pointer dummy argument 'a_pointer=' must be a POINTER unless INTENT(IN)
40 call bar(sin)
42 !ERROR: References to the procedure 'baz' require an explicit interface
43 call baz(sin)
44 end subroutine