1! RUN: %S/test_errors.sh %s %t %f18
2! Test 15.5.2.7 constraints and restrictions for POINTER dummy arguments.
3
4module m
5  real :: coarray(10)[*]
6 contains
7
8  subroutine s01(p)
9    real, pointer, contiguous, intent(in) :: p(:)
10  end subroutine
11  subroutine s02(p)
12    real, pointer :: p(:)
13  end subroutine
14  subroutine s03(p)
15    real, pointer, intent(in) :: p(:)
16  end subroutine
17
18  subroutine test
19    !ERROR: CONTIGUOUS POINTER must be an array
20    real, pointer, contiguous :: a01 ! C830
21    real, pointer :: a02(:)
22    real, target :: a03(10)
23    real :: a04(10) ! not TARGET
24    call s01(a03) ! ok
25    !ERROR: Actual argument associated with CONTIGUOUS POINTER dummy argument 'p=' must be simply contiguous
26    call s01(a02)
27    !ERROR: Actual argument associated with CONTIGUOUS POINTER dummy argument 'p=' must be simply contiguous
28    call s01(a03(::2))
29    call s02(a02) ! ok
30    call s03(a03) ! ok
31    !ERROR: Actual argument associated with POINTER dummy argument 'p=' must also be POINTER unless INTENT(IN)
32    call s02(a03)
33    !ERROR: An array section with a vector subscript may not be a pointer target
34    call s03(a03([1,2,4]))
35    !ERROR: A coindexed object may not be a pointer target
36    call s03(coarray(:)[1])
37    !ERROR: Target associated with dummy argument 'p=' must be a designator or a call to a pointer-valued function
38    call s03([1.])
39    !ERROR: In assignment to object dummy argument 'p=', the target 'a04' is not an object with POINTER or TARGET attributes
40    call s03(a04)
41  end subroutine
42end module
43