| 1 |
/* Testing 'has_device_addr' clause on the target construct with reference. */ |
| 2 |
|
| 3 |
#include <omp.h> |
| 4 |
|
| 5 |
int |
| 6 |
main () |
| 7 |
{ |
| 8 |
int *dpx = (int*)omp_target_alloc (sizeof(int), 0); |
| 9 |
int **dpy = (int**)omp_target_alloc (sizeof(int*), 0); |
| 10 |
|
| 11 |
#pragma omp target is_device_ptr(dpx, dpy) |
| 12 |
{ |
| 13 |
*dpx = 42; |
| 14 |
int z = 77; |
| 15 |
*dpy = &z; |
| 16 |
} |
| 17 |
|
| 18 |
int& x = *dpx; |
| 19 |
int*& y = *dpy; |
| 20 |
|
| 21 |
#pragma omp target has_device_addr(x, y) |
| 22 |
{ |
| 23 |
x = 24; |
| 24 |
y = &x; |
| 25 |
} |
| 26 |
|
| 27 |
#pragma omp target has_device_addr(x, y) |
| 28 |
if (x != 24 || y != &x) |
| 29 |
__builtin_abort (); |
| 30 |
|
| 31 |
omp_target_free(dpx, 0); |
| 32 |
omp_target_free(dpy, 0); |
| 33 |
} |