PR c++/86342 - -Wdeprecated-copy and system headers.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-14.c
blobee21257c9a5d0da5542298360b82b68246202778
1 /* Check acc_is_present. */
3 /* { dg-do run { target openacc_nvidia_accel_selected } } */
5 #include <stdlib.h>
6 #include <openacc.h>
8 #include <stdio.h>
10 int
11 main (int argc, char **argv)
13 const int N = 256;
14 int i;
15 unsigned char *h;
16 void *d;
18 h = (unsigned char *) malloc (N);
20 for (i = 0; i < N; i++)
22 h[i] = i;
25 d = acc_copyin (h, N);
27 if (acc_is_present (h, 1) != 1)
28 abort ();
30 if (acc_is_present (h + N - 1, 1) != 1)
31 abort ();
33 if (acc_is_present (h - 1, 1) != 0)
34 abort ();
36 if (acc_is_present (h + N, 1) != 0)
37 abort ();
39 for (i = 0; i < N; i++)
41 if (acc_is_present (h + i, 1) != 1)
42 abort ();
45 for (i = 0; i < N; i++)
47 if (acc_is_present (h + i, N - i) != 1)
48 abort ();
51 acc_free (d);
53 for (i = 0; i < N; i++)
55 if (acc_is_present (h + i, N - i) != 0)
56 abort ();
60 free (h);
62 return 0;