1! { dg-do run }
2
3program main
4  implicit none
5  integer, parameter         :: n = 1024
6  integer, dimension (0:n-1) :: a, b, c
7  integer                    :: i, ii
8
9  !$acc enter data create (a(0:n-1), b(0:n-1), c(0:n-1))
10
11  !$acc kernels present (a(0:n-1))
12  do i = 0, n - 1
13     a(i) = i * 2
14  end do
15  !$acc end kernels
16
17  !$acc kernels present (b(0:n-1))
18  do i = 0, n -1
19     b(i) = i * 4
20  end do
21  !$acc end kernels
22
23  !$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
24  do ii = 0, n - 1
25     c(ii) = a(ii) + b(ii)
26  end do
27  !$acc end kernels
28
29  !$acc exit data copyout (a(0:n-1), b(0:n-1), c(0:n-1))
30
31  do i = 0, n - 1
32     if (c(i) .ne. a(i) + b(i)) call abort
33  end do
34
35end program main
36