2016-01-15 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / coarray_27.f90
blobde9cfad8df59a8c3ee2e26828af6c6c7dd372ccf
1 ! { dg-do compile }
2 ! { dg-options "-fcoarray=single" }
4 ! Coarray/coindex checks for MOVE_ALLOC
6 integer, allocatable :: a(:), b(:)[:,:], c(:)[:,:]
8 type t
9 integer, allocatable :: d(:)
10 end type t
11 type(t) :: x[*]
12 class(t), allocatable :: y[:], z[:], u
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
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
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" }
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" }
34 end