1! { dg-do run }
2! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } }
3
4program map_multi
5  use openacc
6  implicit none
7  integer, parameter :: n = 512
8  integer, allocatable :: a(:), b(:), c(:)
9
10  allocate(a(1:n))
11  allocate(b(1:n))
12  allocate(c(1:n))
13
14  !$acc data copy(a, b, c)
15
16  ! These arrays have descriptors, so use multiple mappings.  Make sure those
17  ! are matched up properly with the mappings in the enclosing data region.
18  !$acc enter data copyin(a)
19  !$acc enter data copyin(b)
20  !$acc enter data copyin(c)
21
22  !$acc end data
23
24  if (.not.acc_is_present (a)) stop 1
25  if (.not.acc_is_present (b)) stop 2
26  if (.not.acc_is_present (c)) stop 3
27
28  !$acc exit data delete(a)
29
30  if (acc_is_present (a)) stop 4
31  if (.not.acc_is_present (b)) stop 5
32  if (.not.acc_is_present (c)) stop 6
33
34  !$acc exit data delete(b)
35
36  if (acc_is_present (a)) stop 7
37  if (acc_is_present (b)) stop 8
38  if (.not.acc_is_present (c)) stop 9
39
40  !$acc exit data delete(c)
41
42  if (acc_is_present (a)) stop 10
43  if (acc_is_present (b)) stop 11
44  if (acc_is_present (c)) stop 12
45
46  deallocate(a)
47  deallocate(b)
48  deallocate(c)
49end program map_multi
50