1 extern "C" void abort (void);
2 struct S { int s; int *u; int v[5]; };
9 int u[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, err = 0;
10 T s = { 9, u + 3, { 10, 11, 12, 13, 14 } };
12 #pragma omp target enter data map (to: s.s, s.template u[0:5]) map (alloc: s.template v[1:3])
16 #pragma omp target update to (s.template s) to (s.u[0:2], s.v[1:3])
17 #pragma omp target map (alloc: s.s, s.v[1:3]) map (from: err)
20 if (s.s != 10 || s.v[1] != 12 || s.v[2] != 12 || s.v[3] != 13)
22 if (v[-1] != 4 || v[0] != 4 || v[1] != 5 || v[2] != 6 || v[3] != 7)
31 #pragma omp target map (alloc: s.u[0:5])
34 if (s.u[0] != 5 || s.u[1] != 4 || s.u[2] != 5 || s.u[3] != 6 || s.u[4] != 9)
38 #pragma omp target update from (s.s, s.u[0:5]) from (s.v[1:3])
39 if (err || s.s != 11 || u[0] != 0 || u[1] != 1 || u[2] != 2 || u[3] != 5
40 || u[4] != 12 || u[5] != 5 || u[6] != 6 || u[7] != 9 || u[8] != 8
41 || u[9] != 9 || s.v[0] != 10 || s.v[1] != 12 || s.v[2] != 14
42 || s.v[3] != 13 || s.v[4] != 14)
44 #pragma omp target exit data map (release: s.s)
45 #pragma omp target exit data map (release: s.u[0:5])
46 #pragma omp target exit data map (delete: s.v[1:3])
47 #pragma omp target exit data map (release: s.s)
53 int u[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, err = 0;
54 S s = { 9, u + 3, { 10, 11, 12, 13, 14 } };
56 #pragma omp target enter data map (to: s.s, s.u, s.u[0:5]) map (alloc: s.v[1:3])
60 #pragma omp target update to (s.s) to (s.u[0:2], s.v[1:3])
61 #pragma omp target map (alloc: s.s, s.v[1:3]) map (from: err)
64 if (s.s != 10 || s.v[1] != 12 || s.v[2] != 12 || s.v[3] != 13)
66 if (v[-1] != 4 || v[0] != 4 || v[1] != 5 || v[2] != 6 || v[3] != 7)
75 #pragma omp target map (alloc: s.u[0:5])
78 if (s.u[0] != 5 || s.u[1] != 4 || s.u[2] != 5 || s.u[3] != 6 || s.u[4] != 9)
82 #pragma omp target update from (s.s, s.u[0:5]) from (s.v[1:3])
83 if (err || s.s != 11 || u[0] != 0 || u[1] != 1 || u[2] != 2 || u[3] != 5
84 || u[4] != 12 || u[5] != 5 || u[6] != 6 || u[7] != 9 || u[8] != 8
85 || u[9] != 9 || s.v[0] != 10 || s.v[1] != 12 || s.v[2] != 14
86 || s.v[3] != 13 || s.v[4] != 14)
88 #pragma omp target exit data map (release: s.s)
89 #pragma omp target exit data map (release: s.u[0:5])
90 #pragma omp target exit data map (always, delete: s.v[1:3])
91 #pragma omp target exit data map (release: s.s)
92 #pragma omp target exit data map (always delete : s.v[1:3])