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