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