Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray_send_by_ref_1.f08

raw
1 ! { dg-do run }
2 ! { dg-options "-fcoarray=lib -lcaf_single" }
3 ! { dg-additional-options "-latomic" { target libatomic_available } }
4
5 program check_caf_send_by_ref
6
7 implicit none
8
9 type T
10 integer, allocatable :: scal
11 integer, allocatable :: array(:)
12 end type T
13
14 type(T), save :: obj[*]
15 integer :: me, np, i
16
17 me = this_image()
18 np = num_images()
19
20 obj[np]%scal = 42
21
22 ! Check the token for the scalar is set.
23 if (obj[np]%scal /= 42) STOP 1
24
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)])) STOP 2
28
29 end program check_caf_send_by_ref
30