1// RUN: %libomptarget-compilexx-run-and-check-generic
2
3#include <omp.h>
4#include <stdio.h>
5
6int main() {
7 struct S {
8 int i;
9 int j;
10 } s;
11 s.i = 20;
12 s.j = 30;
13#pragma omp target data map(tofrom : s)
14 {
15#pragma omp target map(from : s.i, s.j)
16 {
17 s.i = 21;
18 s.j = 31;
19 }
20 }
21 if (s.i == 21 && s.j == 31)
22 printf(format: "PASS 1\n");
23 // CHECK: PASS 1
24
25 struct T {
26 int a;
27 int b;
28 int c;
29 int d;
30 int i;
31 int j;
32 } t;
33 t.a = 10;
34 t.i = 20;
35 t.j = 30;
36#pragma omp target data map(from : t.i, t.j)
37 {
38#pragma omp target map(from : t.a)
39 {
40 t.a = 11;
41 t.i = 21;
42 t.j = 31;
43 }
44 }
45 if (t.a == 11 && t.i == 21 && t.j == 31)
46 printf(format: "PASS 2\n");
47 // CHECK: PASS 2
48 return 0;
49}
50

source code of offload/test/mapping/low_alignment.c