| 1 | // RUN: %libomptarget-compilexx-run-and-check-generic |
| 2 | |
| 3 | // UNSUPPORTED: amdgcn-amd-amdhsa |
| 4 | |
| 5 | extern "C" int printf(const char *, ...); |
| 6 | |
| 7 | typedef struct { |
| 8 | int a; |
| 9 | } C; |
| 10 | #pragma omp declare mapper(C s) map(to : s.a) |
| 11 | |
| 12 | typedef struct { |
| 13 | int e; |
| 14 | C f; |
| 15 | int h; |
| 16 | } D; |
| 17 | |
| 18 | int main() { |
| 19 | D sa[10]; |
| 20 | sa[1].e = 111; |
| 21 | sa[1].f.a = 222; |
| 22 | |
| 23 | // CHECK: 111 222 |
| 24 | printf("%d %d \n" , sa[1].e, sa[1].f.a); |
| 25 | #pragma omp target map(tofrom : sa[0 : 2]) |
| 26 | { |
| 27 | // CHECK: 111 |
| 28 | printf("%d \n" , sa[1].e); |
| 29 | sa[0].e = 333; |
| 30 | sa[1].f.a = 444; |
| 31 | // CHECK: 333 444 |
| 32 | printf("%d %d \n" , sa[0].e, sa[1].f.a); |
| 33 | } |
| 34 | // CHECK: 333 222 |
| 35 | printf("%d %d \n" , sa[0].e, sa[1].f.a); |
| 36 | } |
| 37 | |