Add a testcase for PR target/66821
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-51.c
blob29d28f298c0bdb77d7fcadebec707fc4bb8491f9
1 /* { dg-do run } */
2 /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
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[N];
13 void *d[N];
15 for (i = 0; i < N; i++)
17 h[i] = (unsigned char *) malloc (N);
18 d[i] = acc_malloc (N);
20 acc_map_data (h[i], d[i], N);
23 for (i = 0; i < N; i++)
25 if (acc_is_present (h[i], N) != 1)
26 abort ();
29 for (i = 0; i < N; i++)
31 acc_unmap_data (h[i]);
33 if (acc_is_present (h[i], N) != 0)
34 abort ();
36 acc_free (d[i]);
37 free (h[i]);
40 return 0;