1! { dg-do run  { target openacc_nvidia_accel_selected } }
2
3module globalvars
4  implicit none
5  real b
6  !$acc declare link (b)
7end module globalvars
8
9program test
10  use openacc
11  use globalvars
12  implicit none
13
14  real a
15  real c
16  !$acc declare link (c)
17
18  if (acc_is_present (b) .neqv. .false.) call abort
19  if (acc_is_present (c) .neqv. .false.) call abort
20
21  a = 0.0
22  b = 1.0
23
24  !$acc parallel copy (a) copyin (b)
25    b = b + 4.0
26    a = b
27  !$acc end parallel
28
29  if (a .ne. 5.0) call abort
30
31  if (acc_is_present (b) .neqv. .false.) call abort
32
33  a = 0.0
34
35  !$acc parallel copy (a) create (b)
36    b = 4.0
37    a = b
38  !$acc end parallel
39
40  if (a .ne. 4.0) call abort
41
42  if (acc_is_present (b) .neqv. .false.) call abort
43
44  a = 0.0
45
46  !$acc parallel copy (a) copy (b)
47    b = 4.0
48    a = b
49  !$acc end parallel
50
51  if (a .ne. 4.0) call abort
52  if (b .ne. 4.0) call abort
53
54  if (acc_is_present (b) .neqv. .false.) call abort
55
56  a = 0.0
57
58  !$acc parallel copy (a) copy (b) copy (c)
59    b = 4.0
60    c = b
61    a = c
62  !$acc end parallel
63
64  if (a .ne. 4.0) call abort
65
66  if (acc_is_present (b) .neqv. .false.) call abort
67
68end program test
69