1 // RUN: %libomptarget-compilexx-run-and-check-generic 2 3 // Wrong results on amdgpu 4 // XFAIL: amdgcn-amd-amdhsa 5 // XFAIL: amdgcn-amd-amdhsa-newRTL 6 7 #include <cstdio> 8 #include <cstdlib> 9 10 typedef struct { 11 int a; 12 double *b; 13 } C; 14 #pragma omp declare mapper(id1 : C s) map(to : s.a) map(from : s.b [0:2]) 15 16 typedef struct { 17 int e; 18 C f; 19 int h; 20 short *g; 21 } D; 22 #pragma omp declare mapper(default \ 23 : D r) map(from \ 24 : r.e) map(mapper(id1), tofrom \ 25 : r.f) map(tofrom \ 26 : r.g [0:r.h]) 27 28 int main() { 29 constexpr int N = 10; 30 D s; 31 s.e = 111; 32 s.f.a = 222; 33 double x[2]; 34 x[1] = 20; 35 short y[N]; 36 y[1] = 30; 37 s.f.b = &x[0]; 38 s.g = &y[0]; 39 s.h = N; 40 41 D *sp = &s; 42 D **spp = &sp; 43 44 printf("%d %d %4.5f %d %d %d\n", spp[0][0].e, spp[0][0].f.a, spp[0][0].f.b[1], 45 spp[0][0].f.b == &x[0] ? 1 : 0, spp[0][0].g[1], 46 spp[0][0].g == &y[0] ? 1 : 0); 47 // CHECK: 111 222 20.00000 1 30 1 48 49 __intptr_t p = reinterpret_cast<__intptr_t>(&x[0]), 50 p1 = reinterpret_cast<__intptr_t>(&y[0]); 51 #pragma omp target map(tofrom : spp[0][0]) firstprivate(p, p1) 52 { 53 printf("%d %d %d %d\n", spp[0][0].f.a, 54 spp[0][0].f.b == reinterpret_cast<void *>(p) ? 1 : 0, spp[0][0].g[1], 55 spp[0][0].g == reinterpret_cast<void *>(p1) ? 1 : 0); 56 // CHECK: 222 0 30 0 57 spp[0][0].e = 333; 58 spp[0][0].f.a = 444; 59 spp[0][0].f.b[1] = 40; 60 spp[0][0].g[1] = 50; 61 } 62 printf("%d %d %4.5f %d %d %d\n", spp[0][0].e, spp[0][0].f.a, spp[0][0].f.b[1], 63 spp[0][0].f.b == &x[0] ? 1 : 0, spp[0][0].g[1], 64 spp[0][0].g == &y[0] ? 1 : 0); 65 // CHECK: 333 222 40.00000 1 50 1 66 } 67