PR target/77349
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-38.c
blob05d8498c1f987efdeacdb92fd472ef20b0573589
1 /* { dg-do run } */
2 /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
4 #include <string.h>
5 #include <stdlib.h>
6 #include <openacc.h>
8 int
9 main (int argc, char **argv)
11 const int N = 256;
12 int i;
13 unsigned char *h;
14 void *d1, *d2;
16 h = (unsigned char *) malloc (N);
18 for (i = 0; i < N; i++)
20 h[i] = i;
23 d1 = acc_present_or_copyin (h, N);
24 if (!d1)
25 abort ();
27 for (i = 0; i < N; i++)
29 h[i] = 0xab;
32 d2 = acc_present_or_copyin (h, N);
33 if (!d2)
34 abort ();
36 if (d1 != d2)
37 abort ();
39 memset (&h[0], 0, N);
41 acc_copyout (h, N);
43 for (i = 0; i < N; i++)
45 if (h[i] != i)
46 abort ();
49 d2 = acc_pcopyin (h, N);
50 if (!d2)
51 abort ();
53 acc_copyout (h, N);
55 for (i = 0; i < N; i++)
57 if (h[i] != i)
58 abort ();
61 free (h);
63 return 0;