]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgomp/testsuite/libgomp.oacc-c-c++-common/lib-51.c
Merge current set of OpenACC changes from gomp-4_0-branch.
[thirdparty/gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-51.c
1 /* { dg-do run } */
2 /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
3
4 #include <stdlib.h>
5 #include <openacc.h>
6
7 int
8 main (int argc, char **argv)
9 {
10 const int N = 256;
11 int i;
12 unsigned char *h[N];
13 void *d[N];
14
15 for (i = 0; i < N; i++)
16 {
17 h[i] = (unsigned char *) malloc (N);
18 d[i] = acc_malloc (N);
19
20 acc_map_data (h[i], d[i], N);
21 }
22
23 for (i = 0; i < N; i++)
24 {
25 if (acc_is_present (h[i], N) != 1)
26 abort ();
27 }
28
29 for (i = 0; i < N; i++)
30 {
31 acc_unmap_data (h[i]);
32
33 if (acc_is_present (h[i], N) != 0)
34 abort ();
35
36 acc_free (d[i]);
37 free (h[i]);
38 }
39
40 return 0;
41 }