Debian Codegraph @

libgomp/testsuite/libgomp.c++/target-49.C

raw
1 #include <cstring>
2 #include <cassert>
3
4 struct s {
5 int (&a)[10];
6 s(int (&a0)[10]) : a(a0) {}
7 };
8
9 int
10 main (int argc, char *argv[])
11 {
12 int la[10];
13 s v_real(la);
14 s *v = &v_real;
15
16 memset (la, 0, sizeof la);
17
18 #pragma omp target enter data map(to: v)
19
20 /* Copying the whole v[0] here DOES NOT WORK yet because the reference 'a' is
21 not copied "as if" it was mapped explicitly as a member. FIXME. */
22 #pragma omp target enter data map(to: v[0])
23
24 #pragma omp target
25 {
26 v->a[5]++;
27 }
28
29 #pragma omp target exit data map(release: v[0])
30 #pragma omp target exit data map(from: v)
31
32 assert (v->a[5] == 1);
33
34 return 0;
35 }
36
37 // { dg-xfail-run-if "TODO" { offload_device_nonshared_as } }