2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / coarray_allocate_9.f08
blob71409e9e6f8ecb0fcc7cdd42f368c236dbac384b
1 ! { dg-do run }
2 ! { dg-options "-fcoarray=lib -lcaf_single" }
3 ! { dg-additional-options "-latomic" { target libatomic_available } }
5 ! Contributed by Damian Rouson
7 program main
8   implicit none
10   type particles
11     real x(2)
12   end type
14   type vector
15     type(particles), allocatable :: v(:)
16   end type
18   type(vector) :: outbox[*]
19   type(particles), allocatable :: object(:)[:]
21   allocate(outbox%v(1), source=particles(this_image()))
23   if (any( outbox[1]%v(1)%x(1:2) /= [ 1.0, 1.0] )) call abort()
24   if (any( outbox[1]%v(1)%x(:) /= [ 1.0, 1.0] )) call abort()
25   if (any( outbox[1]%v(1)%x /= [ 1.0, 1.0] )) call abort()
27   allocate(object(1)[*], source=particles(this_image()))
29   if (any( object(1)[1]%x(1:2) /= [ 1.0, 1.0] )) call abort()
30   if (any( object(1)[1]%x(:) /= [ 1.0, 1.0] )) call abort()
31   if (any( object(1)[1]%x /= [ 1.0, 1.0] )) call abort()
32 end program