1 /* Not all implement this checking.
2 { dg-skip-if "" { openacc_radeon_accel_selected || openacc_host_selected } } */
3
4 #include <stdio.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include <openacc.h>
8
9 int
10 main (int argc, char **argv)
11 {
12 const int N = 256;
13 int i;
14 unsigned char *h;
15 void *d;
16
17 h = (unsigned char *) malloc (N);
18
19 for (i = 0; i < N; i++)
20 {
21 h[i] = i;
22 }
23
24 d = acc_malloc (N);
25
26 acc_memcpy_to_device (d, h, N);
27
28 memset (&h[0], 0, N);
29
30 fprintf (stderr, "CheCKpOInT\n");
31 acc_memcpy_to_device (d, h, N << 1);
32
33 acc_memcpy_from_device (h, d, N);
34
35 for (i = 0; i < N; i++)
36 {
37 if (h[i] != i)
38 abort ();
39 }
40
41 acc_free (d);
42
43 free (h);
44
45 return 0;
46 }
47
48 /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
49 /* { dg-output "invalid size" } */
50 /* { dg-shouldfail "" } */