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