| 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 |
double *dpy = (double*)omp_target_alloc (sizeof(double), 0); |
| 10 |
|
| 11 |
#pragma omp target is_device_ptr(dpx, dpy) |
| 12 |
{ |
| 13 |
*dpx = 42; |
| 14 |
*dpy = 43.5; |
| 15 |
} |
| 16 |
|
| 17 |
int &x = *dpx; |
| 18 |
double &y = *dpy; |
| 19 |
|
| 20 |
#pragma omp target has_device_addr(x, y) |
| 21 |
{ |
| 22 |
x = 24; |
| 23 |
y = 25.7; |
| 24 |
} |
| 25 |
|
| 26 |
#pragma omp target has_device_addr(y, x) |
| 27 |
if (x != 24 || y != 25.7) |
| 28 |
__builtin_abort (); |
| 29 |
|
| 30 |
omp_target_free(dpx, 0); |
| 31 |
omp_target_free(dpy, 0); |
| 32 |
} |