Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray_allocate_9.f08

raw
1 ! { dg-do run }
2 ! { dg-options "-fcoarray=lib -lcaf_single" }
3 ! { dg-additional-options "-latomic" { target libatomic_available } }
4
5 ! Contributed by Damian Rouson
6
7 program main
8 implicit none
9
10 type particles
11 real x(2)
12 end type
13
14 type vector
15 type(particles), allocatable :: v(:)
16 end type
17
18 type(vector) :: outbox[*]
19 type(particles), allocatable :: object(:)[:]
20
21 allocate(outbox%v(1), source=particles(this_image()))
22
23 if (any( outbox[1]%v(1)%x(1:2) /= [ 1.0, 1.0] )) STOP 1
24 if (any( outbox[1]%v(1)%x(:) /= [ 1.0, 1.0] )) STOP 2
25 if (any( outbox[1]%v(1)%x /= [ 1.0, 1.0] )) STOP 3
26
27 allocate(object(1)[*], source=particles(this_image()))
28
29 if (any( object(1)[1]%x(1:2) /= [ 1.0, 1.0] )) STOP 4
30 if (any( object(1)[1]%x(:) /= [ 1.0, 1.0] )) STOP 5
31 if (any( object(1)[1]%x /= [ 1.0, 1.0] )) STOP 6
32 end program