* tree-ssa-loop-ivopts.c (relate_compare_use_with_all_cands): Handle
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / lib-61.c
blobce66ced28e818e182a9a60ff6e7db2213b41c3ae
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[N];
14 void *d[N];
16 for (i = 0; i < N; i++)
18 int j;
19 unsigned char *p;
21 h[i] = (unsigned char *) malloc (N);
23 p = h[i];
25 for (j = 0; j < N; j++)
27 p[j] = i;
30 d[i] = acc_malloc (N);
32 acc_memcpy_to_device (d[i], h[i], N);
34 for (j = 0; j < N; j++)
36 if (acc_is_present (h[i] + j, 1) != 0)
37 abort ();
41 for (i = 0; i < N; i++)
43 int j;
44 unsigned char *p;
46 memset (h[i], 0, N);
48 acc_memcpy_from_device (h[i], d[i], N);
50 p = h[i];
52 for (j = 0; j < N; j++)
54 if (p[j] != i)
55 abort ();
58 for (j = 0; j < N; j++)
60 if (acc_is_present (h[i] + j, 1) != 0)
61 abort ();
64 acc_free (d[i]);
66 free (h[i]);
69 return 0;