OpenACC documentation updates.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c / lib-14.c
bloba9632f786ee8389f94cab3a42657bb534426ddf5
1 /* { dg-do run } */
3 #include <stdlib.h>
4 #include <openacc.h>
6 #include <stdio.h>
8 int
9 main (int argc, char **argv)
11 const int N = 256;
12 int i;
13 unsigned char *h;
14 void *d;
16 h = (unsigned char *) malloc (N);
18 for (i = 0; i < N; i++)
20 h[i] = i;
23 d = acc_copyin (h, N);
25 if (acc_is_present (h, 1) != 1)
26 abort ();
28 if (acc_is_present (h + N - 1, 1) != 1)
29 abort ();
31 if (acc_is_present (h - 1, 1) != 0)
32 abort ();
34 if (acc_is_present (h + N, 1) != 0)
35 abort ();
37 for (i = 0; i < N; i++)
39 if (acc_is_present (h + i, 1) != 1)
40 abort ();
43 for (i = 0; i < N; i++)
45 if (acc_is_present (h + i, N - i) != 1)
46 abort ();
49 acc_free (d);
51 for (i = 0; i < N; i++)
53 if (acc_is_present (h + i, N - i) != 0)
54 abort ();
58 free (h);
60 return 0;