libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-4.c
raw| 1 | /* { dg-do run { target openacc_nvidia_accel_selected } } */ |
| 2 | |
| 3 | #include <openacc.h> |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | #define N 1024 |
| 7 | |
| 8 | int main (int argc, char* argv[]) |
| 9 | { |
| 10 | int x[N], *xp2; |
| 11 | |
| 12 | #pragma acc data copyin (x[0:N]) |
| 13 | { |
| 14 | int *xp; |
| 15 | #pragma acc host_data use_device (x) |
| 16 | { |
| 17 | #pragma acc data |
| 18 | { |
| 19 | xp = x; |
| 20 | } |
| 21 | xp2 = x; |
| 22 | } |
| 23 | |
| 24 | if (xp != acc_deviceptr (x) || xp2 != xp) |
| 25 | abort (); |
| 26 | } |
| 27 | |
| 28 | return 0; |
| 29 | } |