1! RUN: %B/test/Semantics/test_errors.sh %s %flang %t
2! Object pointer initializer error tests
3
4subroutine test(j)
5  integer, intent(in) :: j
6  real, allocatable, target, save :: x1
7  real, codimension[*], target, save :: x2
8  real, save :: x3
9  real, target :: x4
10  real, target, save :: x5(10)
11!ERROR: An initial data target may not be a reference to an ALLOCATABLE 'x1'
12  real, pointer :: p1 => x1
13!ERROR: An initial data target may not be a reference to a coarray 'x2'
14  real, pointer :: p2 => x2
15!ERROR: An initial data target may not be a reference to an object 'x3' that lacks the TARGET attribute
16  real, pointer :: p3 => x3
17!ERROR: An initial data target may not be a reference to an object 'x4' that lacks the SAVE attribute
18  real, pointer :: p4 => x4
19!ERROR: Pointer 'p5' cannot be initialized with a reference to a designator with non-constant subscripts
20  real, pointer :: p5 => x5(j)
21!ERROR: Pointer 'p6' of rank 0 cannot be initialized with a target of different rank (1)
22  real, pointer :: p6 => x5
23
24!TODO: type incompatibility, non-deferred type parameter values, contiguity
25
26end subroutine test
27