OpenACC documentation updates.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c / lib-65.c
blob26c8cefdc428e222985ec663ee265e18014a9299
1 /* { dg-do run } */
3 #include <string.h>
4 #include <stdlib.h>
5 #include <openacc.h>
7 int
8 main (int argc, char **argv)
10 const int N = 256;
11 int i;
12 unsigned char *h;
13 void *d;
15 h = (unsigned char *) malloc (N);
17 for (i = 0; i < N; i++)
19 h[i] = i;
22 d = acc_malloc (N);
24 acc_memcpy_to_device (d, d, N);
26 memset (&h[0], 0, N);
28 acc_memcpy_from_device (h, d, N);
30 for (i = 0; i < N; i++)
32 if (h[i] != i)
33 abort ();
36 acc_free (d);
38 free (h);
40 return 0;
43 /* { dg-shouldfail "libgomp: invalid host or device address" } */