Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / mapping / ptr_and_obj_motion.c
blob8fa2c9865b4acf327e5220ad912b77b6efca9d40
1 // RUN: %libomptarget-compile-run-and-check-generic
3 #include <stdio.h>
5 typedef struct {
6 double *dataptr;
7 int dummy1;
8 int dummy2;
9 } DV;
11 void init(double vertexx[]) {
12 #pragma omp target map(vertexx[0 : 100])
14 printf("In init: %lf, expected 100.0\n", vertexx[77]);
15 vertexx[77] = 77.0;
19 void change(DV *dvptr) {
20 #pragma omp target map(dvptr->dataptr[0 : 100])
22 printf("In change: %lf, expected 77.0\n", dvptr->dataptr[77]);
23 dvptr->dataptr[77] += 1.0;
27 int main() {
28 double vertexx[100];
29 vertexx[77] = 100.0;
31 DV dv;
32 dv.dataptr = &vertexx[0];
34 #pragma omp target enter data map(to : vertexx[0 : 100])
36 init(vertexx);
37 change(&dv);
39 #pragma omp target exit data map(from : vertexx[0 : 100])
41 // CHECK: Final: 78.0
42 printf("Final: %lf\n", vertexx[77]);