AVR: Assert minimal required bit width of section_common::flags.
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-60.c
blob70cbcb8b0130e49b3755798e60e68fb7da26d0e6
1 /* { dg-do run } */
2 /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
4 /* Fortran testcase is at libgomp.oacc-fortran/acc-memcpy.f90. */
6 #include <string.h>
7 #include <stdlib.h>
8 #include <openacc.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_malloc (N);
27 acc_memcpy_to_device (d, h, N);
29 for (i = 0; i < N; i++)
31 if (acc_is_present (h + i, 1) != 0)
32 abort ();
35 memset (&h[0], 0, N);
37 acc_memcpy_from_device (h, d, N);
39 for (i = 0; i < N; i++)
41 if (h[i] != i)
42 abort ();
45 for (i = 0; i < N; i++)
47 if (acc_is_present (h + i, 1) != 0)
48 abort ();
51 acc_free (d);
53 free (h);
55 return 0;