xref: /llvm-project/flang/test/Semantics/procinterface02.f90 (revision 1c91d9bdea3b6c38e8fbce46ec8181a9c0aa26f8)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2subroutine foo(A, B, P)
3  interface
4    real elemental function foo_elemental(x)
5      real, intent(in) :: x
6    end function
7    pure real function foo_pure(x)
8      real, intent(in) :: x
9    end function
10    real function foo_nonelemental(x)
11      real, intent(in) :: x
12    end function
13  end interface
14  real :: A(:), B(:)
15  !PORTABILITY: A dummy procedure should not have an ELEMENTAL intrinsic as its interface
16  procedure(sqrt), pointer :: P
17  !ERROR: Rank of dummy argument is 0, but actual argument has rank 1
18  A = P(B)
19  !ERROR: Procedure pointer 'p' associated with incompatible procedure designator 'foo_elemental': incompatible procedure attributes: Elemental
20  P => foo_elemental
21  P => foo_pure ! ok
22  !ERROR: PURE procedure pointer 'p' may not be associated with non-PURE procedure designator 'foo_nonelemental'
23  P => foo_nonelemental
24end subroutine
25