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