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