Skip gnat.dg/prot7.adb on hppa.
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / struct-elem-4.c
blob9a23b4fbb811c986fcab1c7aa401c124110637fc
1 #include <omp.h>
2 #include <stdlib.h>
4 struct S
6 int a, b, c, d, e;
7 };
8 typedef struct S S;
10 int main (void)
12 int d = omp_get_default_device ();
13 int id = omp_get_initial_device ();
15 if (d < 0 || d >= omp_get_num_devices ())
16 d = id;
18 S s = { 1, 2, 3, 4, 5 };
19 #pragma omp target enter data map (to:s)
21 int *p = &s.b;
22 int *q = &s.d;
23 #pragma omp target enter data map (alloc: p[:1], q[:1])
25 s.b = 88;
26 s.d = 99;
28 #pragma omp target exit data map (release: s)
29 if (d != id)
31 if (!omp_target_is_present (&s, d))
32 abort ();
33 if (!omp_target_is_present (&p[0], d))
34 abort ();
35 if (!omp_target_is_present (&q[0], d))
36 abort ();
39 #pragma omp target exit data map (from: q[:1])
40 if (d != id)
42 if (omp_target_is_present (&s, d))
43 abort ();
44 if (omp_target_is_present (&p[0], d))
45 abort ();
46 if (omp_target_is_present (&q[0], d))
47 abort ();
49 if (q[0] != 4)
50 abort ();
51 if (p[0] != 88)
52 abort ();
55 return 0;