Skip gnat.dg/prot7.adb on hppa.
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / struct-elem-2.c
blobc50b299c60748e072b312a6c756306d0fea5ba96
1 #include <omp.h>
2 #include <stdlib.h>
4 struct S
6 int a, b, c, d;
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;
19 #pragma omp target enter data map (alloc: s.a, s.b, s.c, s.d)
20 #pragma omp target enter data map (alloc: s.c)
21 #pragma omp target enter data map (alloc: s.b, s.d)
22 #pragma omp target enter data map (alloc: s.a, s.c, s.b)
24 #pragma omp target exit data map (release: s.a)
25 #pragma omp target exit data map (release: s.d)
26 #pragma omp target exit data map (release: s.c)
27 #pragma omp target exit data map (release: s.b)
29 /* OpenMP 5.0 structure element mapping rules describe that elements of same
30 structure variable should allocate/deallocate in a uniform fashion, so
31 all elements of 's' should be removed together by above 'exit data's. */
32 if (d != id)
34 if (omp_target_is_present (&s, d))
35 abort ();
36 if (omp_target_is_present (&s.a, d))
37 abort ();
38 if (omp_target_is_present (&s.b, d))
39 abort ();
40 if (omp_target_is_present (&s.c, d))
41 abort ();
42 if (omp_target_is_present (&s.d, d))
43 abort ();
46 return 0;