Debian Codegraph @

gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-fdump-tree-original -fcoarray=lib -lcaf_single" }
3 ! { dg-additional-options "-latomic" { target libatomic_available } }
4 !
5 ! Some dependency-analysis check for coarray communication
6 !
7 integer, target, save :: A(10)[*]
8 integer, pointer :: P(:)
9 integer, save :: B(10)[*]
10
11 A = [1,2,3,4,5,6,7,8,9,10]
12 B = [1,2,3,4,5,6,7,8,9,10]
13 A(10:2:-1) = A(9:1:-1)[1] ! 0
14 B(10:2:-1) = B(9:1:-1)
15 if (any (A-B /= 0)) STOP 1
16
17 A = [1,2,3,4,5,6,7,8,9,10]
18 B = [1,2,3,4,5,6,7,8,9,10]
19 A(9:1:-1) = A(10:2:-1)[1] ! 1
20 B(9:1:-1) = B(10:2:-1)
21 if (any (A-B /= 0)) STOP 2
22
23 A = [1,2,3,4,5,6,7,8,9,10]
24 B = [1,2,3,4,5,6,7,8,9,10]
25 allocate(P(10))
26 P(:) = A(:)[1] ! 1
27 if (any (A-B /= 0)) STOP 3
28
29 A = [1,2,3,4,5,6,7,8,9,10]
30 B = [1,2,3,4,5,6,7,8,9,10]
31 allocate(P(10))
32 P(:) = B(:)[1] ! 0
33
34 A = [1,2,3,4,5,6,7,8,9,10]
35 B = [1,2,3,4,5,6,7,8,9,10]
36 A(1:5)[1] = A(3:7)[1] ! 1
37 B(1:5) = B(3:7)
38 if (any (A-B /= 0)) STOP 4
39 end
40
41 ! { dg-final { scan-tree-dump-times "_gfortran_caf_get_from_remote" 4 "original" } }
42 ! { dg-final { scan-tree-dump-times "_gfortran_caf_transfer_between_remotes" 1 "original" } }
43 ! { dg-final { scan-tree-dump-not "_gfortran_caf_transfer_get" "original" } }
44 ! { dg-final { scan-tree-dump-not "_gfortran_caf_transfer_send" "original" } }
45