1! { dg-do compile }
2! { dg-options "-fcoarray=single" }
3!
4! Coarray/coindex checks for MOVE_ALLOC
5!
6integer, allocatable :: a(:), b(:)[:,:], c(:)[:,:]
7
8type t
9  integer, allocatable :: d(:)
10end type t
11type(t) :: x[*]
12class(t), allocatable :: y[:], z[:], u
13
14
15call move_alloc (A, b) ! { dg-error "must have the same corank" }
16call move_alloc (c, A) ! { dg-error "must have the same corank" }
17call move_alloc (b, c) ! OK - same corank
18
19call move_alloc (u, y) ! { dg-error "must have the same corank" }
20call move_alloc (z, u) ! { dg-error "must have the same corank" }
21call move_alloc (y, z) ! OK - same corank
22
23
24call move_alloc (x%d, a)  ! OK
25call move_alloc (a, x%d)  ! OK
26call move_alloc (x[1]%d, a) ! { dg-error "The FROM argument to MOVE_ALLOC at .1. shall not be coindexed" }
27call move_alloc (a, x[1]%d) ! { dg-error "The TO argument to MOVE_ALLOC at .1. shall not be coindexed" }
28
29call move_alloc (y%d, a)  ! OK
30call move_alloc (a, y%d)  ! OK
31call move_alloc (y[1]%d, a) ! { dg-error "The FROM argument to MOVE_ALLOC at .1. shall not be coindexed" }
32call move_alloc (a, y[1]%d) ! { dg-error "The TO argument to MOVE_ALLOC at .1. shall not be coindexed" }
33
34end
35