AVR: Assert minimal required bit width of section_common::flags.
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / deep-copy-11.c
blobdb6012fb352bacf2a9f9a6b4061f59074ad449ab
1 #include <stdlib.h>
3 /* Test multiple struct dereferences on one directive, and slices starting at
4 non-zero. */
6 typedef struct {
7 int *a;
8 int *b;
9 int *c;
10 } mystruct;
12 int main(int argc, char* argv[])
14 const int N = 1024;
15 mystruct *m = (mystruct *) malloc (sizeof (*m));
16 int i;
18 m->a = (int *) malloc (N * sizeof (int));
19 m->b = (int *) malloc (N * sizeof (int));
20 m->c = (int *) malloc (N * sizeof (int));
22 for (i = 0; i < N; i++)
24 m->a[i] = 0;
25 m->b[i] = 0;
26 m->c[i] = 0;
29 #pragma acc enter data copyin(m[0:1])
31 for (int i = 0; i < 99; i++)
33 int j;
34 #pragma acc parallel loop copy(m->a[0:N])
35 for (j = 0; j < N; j++)
36 m->a[j]++;
37 #pragma acc parallel loop copy(m->b[0:N], m->c[5:N-10])
38 for (j = 0; j < N; j++)
40 m->b[j]++;
41 if (j > 5 && j < N - 5)
42 m->c[j]++;
46 #pragma acc exit data copyout(m[0:1])
48 for (i = 0; i < N; i++)
50 if (m->a[i] != 99)
51 abort ();
52 if (m->b[i] != 99)
53 abort ();
54 if (i > 5 && i < N-5)
56 if (m->c[i] != 99)
57 abort ();
59 else
61 if (m->c[i] != 0)
62 abort ();
66 free (m->a);
67 free (m->b);
68 free (m->c);
69 free (m);
71 return 0;