]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libgomp/testsuite/libgomp.c-c++-common/baseptrs-2.c
21 int main (int argc
, char *argv
[])
25 p
= (sa
*) malloc (sizeof *p
);
26 p
->b
= (sb
*) malloc (sizeof *p
->b
);
27 p
->b
->c
= (sc
*) malloc (sizeof *p
->b
->c
);
28 p
->c
= (sc
*) malloc (sizeof *p
->c
);
29 p
->b
->c
->ptr
= (int *) malloc (N
* sizeof (int));
30 p
->c
->ptr
= (int *) malloc (N
* sizeof (int));
32 for (int i
= 0; i
< N
; i
++)
40 #pragma omp target map(to: p->b, p->b[0], p->c, p->c[0], p->b->c, p->b->c[0]) \
41 map(to: p->b->c->ptr, p->c->ptr) \
42 map(tofrom: p->b->c->ptr[:N], p->c->ptr[:N])
44 for (int i
= 0; i
< N
; i
++)
51 #pragma omp target map(to: p->b, p->b[0], p->b->c, p->c) \
52 map(tofrom: p->c[0], p->b->c[0])
54 for (int i
= 0; i
< N
; i
++)
56 p
->b
->c
->arr
[i
] = i
* 3;
61 for (int i
= 0; i
< N
; i
++)
63 assert (p
->b
->c
->ptr
[i
] == i
);
64 assert (p
->c
->ptr
[i
] == i
* 2);
65 assert (p
->b
->c
->arr
[i
] == i
* 3);
66 assert (p
->c
->arr
[i
] == i
* 4);