xref: /llvm-project/flang/test/Semantics/call36.f90 (revision 9299bde9e3797db3e46938eb7a53191826fb19c1)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2! Test the RelaxedIntentInChecking extension
3module m
4 contains
5  subroutine intentInUnlimited(x)
6    class(*), dimension(..), pointer, intent(in) :: x
7  end
8  subroutine intentInOutUnlimited(x)
9    class(*), dimension(..), pointer, intent(in out) :: x
10  end
11  subroutine test
12    integer, target :: scalar
13    real, pointer :: arrayptr(:)
14    class(*), pointer :: unlimited(:)
15    call intentInUnlimited(scalar)
16    !ERROR: Actual argument associated with POINTER dummy argument 'x=' must also be POINTER unless INTENT(IN)
17    call intentInOutUnlimited(scalar)
18    !PORTABILITY: If a POINTER or ALLOCATABLE dummy or actual argument is unlimited polymorphic, both should be so
19    call intentInUnlimited(arrayptr)
20    !ERROR: If a POINTER or ALLOCATABLE dummy or actual argument is unlimited polymorphic, both must be so
21    call intentInOutUnlimited(arrayptr)
22    call intentInUnlimited(unlimited) ! ok
23    call intentInOutUnlimited(unlimited) ! ok
24  end
25end
26