c-family: Enable -fpermissive for C and ObjC
[official-gcc.git] / libgomp / testsuite / libgomp.c++ / target-has-device-addr-5.C
blobe847cdceb441742e70da452f039b05c96ba68f04
1 /* Testing 'has_device_addr' clause on the target construct with reference. */
3 #include <omp.h>
5 int
6 main ()
8   int *dpx = (int*)omp_target_alloc (sizeof(int), 0);
9   int **dpy = (int**)omp_target_alloc (sizeof(int*), 0);
11   #pragma omp target is_device_ptr(dpx, dpy)
12     {
13       *dpx = 42;
14       int z = 77;
15       *dpy = &z;
16     }
18   int& x = *dpx;
19   int*& y = *dpy;
21   #pragma omp target has_device_addr(x, y)
22     {
23       x = 24;
24       y = &x;
25     }
27   #pragma omp target has_device_addr(x, y)
28     if (x != 24 || y != &x)
29       __builtin_abort ();
31   omp_target_free(dpx, 0);
32   omp_target_free(dpy, 0);