OpenACC documentation updates.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c / lib-67.c
blob01b8b2d89ae9b15c592e391d088a704534bb4e62
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, h, N);
26 memset (&h[0], 0, N);
28 acc_memcpy_from_device (0, 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 address" } */