Fix type compatibility for types with flexible array member 2/2 [PR113688,PR114713...
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-66.c
blob398dc2a4cefeb9f3a485d5349b76c58d9366687a
1 /* { dg-do run } */
2 /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
4 #include <string.h>
5 #include <stdlib.h>
6 #include <openacc.h>
8 int
9 main (int argc, char **argv)
11 const int N = 256;
12 int i;
13 unsigned char *h;
14 void *d;
16 acc_init (acc_device_default);
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 memset (&h[0], 0, N);
31 acc_memcpy_to_device (d, h, 0);
33 acc_memcpy_from_device (h, d, N);
35 for (i = 0; i < N; i++)
37 if (h[i] != i)
38 abort ();
41 acc_free (d);
43 free (h);
45 acc_shutdown (acc_device_default);
47 return 0;