1 /* PR libgomp/109837 */
8 #pragma omp requires unified_address
22 s
.ptr
= (int *) omp_target_alloc (sizeof (int)*s
.n
, dev
);
23 int *ptr1
= (int *) omp_target_alloc (sizeof (int)*N
, dev
);
24 assert (s
.ptr
!= NULL
);
25 assert (ptr1
!= NULL
);
29 #pragma omp target enter data map(q) device(device_num: dev)
30 #pragma omp target data use_device_addr(q) device(device_num: dev)
33 #pragma omp target map(to:s) device(device_num: dev)
34 for (int i
= 0; i
< s
.n
; i
++)
37 int *ptr2
= &s
.ptr
[3];
39 #pragma omp target firstprivate(qptr) map(tofrom:ptr2) device(device_num: dev)
40 for (int i
= 0; i
< 4; i
++)
43 #pragma omp target exit data map(q) device(device_num: dev)
44 for (int i
= 0; i
< 4; i
++)
47 #pragma omp target map(to: ptr1) device(device_num: dev)
48 for (int i
= 0; i
< N
; i
++)
51 int *ptr3
= (int *) malloc (sizeof (int)*N
);
52 assert (0 == omp_target_memcpy(ptr3
, ptr1
, N
* sizeof(int), 0, 0,
53 omp_get_initial_device(), dev
));
54 for (int i
= 0; i
< N
; i
++)
55 assert (ptr3
[i
] == 11*i
);
58 omp_target_free (ptr1
, dev
);
59 omp_target_free (s
.ptr
, dev
);
65 int ntgts
= omp_get_num_devices();
67 fprintf (stderr
, "Offloading devices exist\n"); /* { dg-output "Offloading devices exist(\n|\r\n|\r)" { target offload_device } } */
69 fprintf (stderr
, "Only host fallback\n"); /* { dg-output "Only host fallback(\n|\r\n|\r)" { target { ! offload_device } } } */
71 for (int i
= 0; i
<= ntgts
; i
++)