2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / coarray_send_by_ref_1.f08
blob75773f6465cfd5d63639553c273faf4705f05603
1 ! { dg-do run }
2 ! { dg-options "-fcoarray=lib -lcaf_single" }
3 ! { dg-additional-options "-latomic" { target libatomic_available } }
5 program check_caf_send_by_ref
7   implicit none
9   type T
10     integer, allocatable :: scal
11     integer, allocatable :: array(:)
12   end type T
14   type(T), save :: obj[*]
15   integer :: me, np, i
17   me = this_image()
18   np = num_images()
20   obj[np]%scal = 42
22   ! Check the token for the scalar is set.
23   if (obj[np]%scal /= 42) call abort()
25   ! Now the same for arrays.
26   obj[np]%array = [(i * np + me, i = 1, 15)]
27   if (any(obj[np]%array /= [(i * np + me, i = 1, 15)])) call abort()
29 end program check_caf_send_by_ref