aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/coarray_27.f90
blob: de9cfad8df59a8c3ee2e26828af6c6c7dd372ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
! { dg-do compile }
! { dg-options "-fcoarray=single" }
!
! Coarray/coindex checks for MOVE_ALLOC
!
integer, allocatable :: a(:), b(:)[:,:], c(:)[:,:]

type t
  integer, allocatable :: d(:)
end type t
type(t) :: x[*]
class(t), allocatable :: y[:], z[:], u


call move_alloc (A, b) ! { dg-error "must have the same corank" }
call move_alloc (c, A) ! { dg-error "must have the same corank" }
call move_alloc (b, c) ! OK - same corank

call move_alloc (u, y) ! { dg-error "must have the same corank" }
call move_alloc (z, u) ! { dg-error "must have the same corank" }
call move_alloc (y, z) ! OK - same corank


call move_alloc (x%d, a)  ! OK
call move_alloc (a, x%d)  ! OK
call move_alloc (x[1]%d, a) ! { dg-error "The FROM argument to MOVE_ALLOC at .1. shall not be coindexed" }
call move_alloc (a, x[1]%d) ! { dg-error "The TO argument to MOVE_ALLOC at .1. shall not be coindexed" }

call move_alloc (y%d, a)  ! OK
call move_alloc (a, y%d)  ! OK
call move_alloc (y[1]%d, a) ! { dg-error "The FROM argument to MOVE_ALLOC at .1. shall not be coindexed" }
call move_alloc (a, y[1]%d) ! { dg-error "The TO argument to MOVE_ALLOC at .1. shall not be coindexed" }

end