blob: 91549ac4d245af7a6c7cb2a94c884b35596baf6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// { dg-do run }
// { dg-options "-fopenmp" }
#include <assert.h>
#include <stdlib.h>
typedef struct
{
int x[10];
} S;
typedef struct
{
S ***s;
} T;
typedef struct
{
T **t;
} U;
void
foo (void)
{
U *u = (U *) malloc (sizeof (U));
T *real_t = (T *) malloc (sizeof (T));
S *real_s = (S *) malloc (sizeof (S));
T **t_pp = &real_t;
S **s_pp = &real_s;
S ***s_ppp = &s_pp;
u->t = t_pp;
(*u->t)->s = s_ppp;
for (int i = 0; i < 10; i++)
(**((*u->t)->s))->x[i] = 0;
#pragma omp target map(u->t, *u->t, (*u->t)->s, *(*u->t)->s, **(*u->t)->s, \
(**(*u->t)->s)->x[0:10])
for (int i = 0; i < 10; i++)
(**((*u->t)->s))->x[i] = i * 3;
for (int i = 0; i < 10; i++)
assert ((**((*u->t)->s))->x[i] == i * 3);
free (real_s);
free (real_t);
free (u);
}
int main (int argc, char *argv[])
{
foo ();
return 0;
}
|