Remove xfail for hppa*-*-hpux* from stdatomic-flag.c and stdatomic-flag-2.c
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c++ / deep-copy-13.C
bloba51945686033fe9c483e315d491e74f979b24dce
1 #include <stdlib.h>
3 /* Test array slice with reference to pointer.  */
5 typedef struct {
6   int *a;
7   int *b;
8   int *c;
9 } mystruct;
11 int main(int argc, char* argv[])
13   const int N = 1024;
14   mystruct *m = (mystruct *) malloc (sizeof (*m));
15   int i;
17   m->a = (int *) malloc (N * sizeof (int));
18   m->b = (int *) malloc (N * sizeof (int));
19   m->c = (int *) malloc (N * sizeof (int));
21   for (i = 0; i < N; i++)
22     {
23       m->a[i] = 0;
24       m->b[i] = 0;
25       m->c[i] = 0;
26     }
28 #pragma acc enter data copyin(m[0:1])
30   for (int i = 0; i < 99; i++)
31     {
32       int j;
33       int *&ptr = m->a;
34 #pragma acc parallel loop copy(ptr[0:N])
35       for (j = 0; j < N; j++)
36         ptr[j]++;
37 #pragma acc parallel loop copy(m->b[0:N], m->c[5:N-10])
38       for (j = 0; j < N; j++)
39         {
40           m->b[j]++;
41           if (j > 5 && j < N - 5)
42             m->c[j]++;
43         }
44     }
46 #pragma acc exit data copyout(m[0:1])
48   for (i = 0; i < N; i++)
49     {
50       if (m->a[i] != 99)
51         abort ();
52       if (m->b[i] != 99)
53         abort ();
54       if (i > 5 && i < N-5)
55         {
56           if (m->c[i] != 99)
57             abort ();
58         }
59       else
60         {
61           if (m->c[i] != 0)
62             abort ();
63         }
64     }
66   free (m->a);
67   free (m->b);
68   free (m->c);
69   free (m);
71   return 0;