xref: /llvm-project/flang/test/Semantics/call34.f90 (revision 191d48723f8b853a6ad65532c173c67155cbe606)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic -Werror
2module m
3 contains
4  subroutine foo(a)
5    real, intent(in), target :: a(:)
6  end subroutine
7end module
8
9program test
10  use m
11  real, target :: a(1)
12  real :: b(1)
13  call foo(a) ! ok
14  !WARNING: Any pointer associated with TARGET dummy argument 'a=' during this call must not be used afterwards, as 'b' is not a target
15  call foo(b)
16  !WARNING: Any pointer associated with TARGET dummy argument 'a=' during this call will not be associated with the value of '(a)' afterwards
17  call foo((a))
18  !WARNING: Any pointer associated with TARGET dummy argument 'a=' during this call will not be associated with the value of 'a([INTEGER(8)::1_8])' afterwards
19  call foo(a([1]))
20  !ERROR: Scalar actual argument may not be associated with assumed-shape dummy argument 'a='
21  call foo(a(1))
22end
23