1 // RUN: %libomptarget-compile-run-and-check-generic
3 // Clang 6.0 doesn't use the new map interface, undefined behavior when
4 // the compiler emits "old" interface code for structures.
5 // UNSUPPORTED: clang-6
15 int main(int argc
, char *argv
[]) {
17 s
.ptr1
= malloc(sizeof(int));
18 s
.ptr2
= malloc(2 * sizeof(int));
19 s2
.ptr1
= malloc(sizeof(int));
20 s2
.ptr2
= malloc(2 * sizeof(int));
22 #pragma omp target enter data map(to : s2.ptr2[0 : 1])
23 #pragma omp target map(s.ptr1[0 : 1], s.ptr2[0 : 2])
29 #pragma omp target exit data map(from : s2.ptr1[0 : 1], s2.ptr2[0 : 1])
31 // CHECK: s.ptr1[0] = 1
32 // CHECK: s.ptr2[0] = 2
33 // CHECK: s.ptr2[1] = 3
34 printf("s.ptr1[0] = %d\n", s
.ptr1
[0]);
35 printf("s.ptr2[0] = %d\n", s
.ptr2
[0]);
36 printf("s.ptr2[1] = %d\n", s
.ptr2
[1]);