1 /* { dg-require-effective-target offload_device_nonshared_as } */
8 void test_array_section (int *p
)
10 #pragma omp target data map(alloc: p[0:N])
13 for (int i
= 10; i
< 10 + 4; i
++)
16 #pragma omp target map(always to:p[10:4]) map(tofrom: ok)
17 for (int i
= 10; i
< 10 + 4; i
++)
23 #pragma omp target map(always from:p[7:9])
24 for (int i
= 0; i
< N
; i
++)
31 int aa
= 0, bb
= 0, cc
= 0, dd
= 0;
33 #pragma omp target data map(tofrom: aa) map(to: bb) map(from: cc, dd)
38 /* Set dd on target to 0 for the further check. */
39 #pragma omp target map(always to: dd)
43 #pragma omp target map(tofrom: aa) map(always to: bb) \
44 map(always from: cc) map(to: dd) map(from: ok)
46 /* bb is always to, aa and dd are not. */
47 ok
= (aa
== 0) && (bb
== 1) && (dd
== 0);
48 aa
= bb
= cc
= dd
= 2;
54 assert (cc
== 2); /* cc is always from. */
58 #pragma omp target map(from: cc) map(always to: dd) map(from: ok)
60 ok
= (dd
== 3); /* dd is always to. */
74 int *array
= calloc (N
, sizeof (int));
75 test_array_section (array
);
77 for (int i
= 0; i
< 7; i
++)
78 assert (array
[i
] == 0);
79 for (int i
= 7; i
< 7 + 9; i
++)
80 assert (array
[i
] == i
);
81 for (int i
= 7 + 9; i
< N
; i
++)
82 assert (array
[i
] == 0);