Add a testcase for PR target/66821
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / present-1.c
blobd8fcb716b9bae31438bca51564b9244146fd3c28
1 /* { dg-do run } */
2 /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
4 #include <openacc.h>
5 #include <string.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <stdbool.h>
10 int
11 main (int argc, char **argv)
13 int N = 8;
14 float *a, *b, *c, *d;
15 int i;
17 a = (float *) malloc (N * sizeof (float));
18 b = (float *) malloc (N * sizeof (float));
19 c = (float *) malloc (N * sizeof (float));
21 d = (float *) acc_malloc (N * sizeof (float));
22 acc_map_data (c, d, N * sizeof (float));
24 #pragma acc data present (a[0:N]) present (c[0:N]) present (b[0:N])
26 #pragma acc parallel
28 int ii;
30 for (ii = 0; ii < N; ii++)
32 c[ii] = a[ii];
33 b[ii] = c[ii];
38 d = (float *) acc_deviceptr (c);
39 acc_unmap_data (c);
40 acc_free (d);
42 free (a);
43 free (b);
44 free (c);
46 return 0;
48 /* { dg-output "present clause: !acc_is_present" } */
49 /* { dg-shouldfail "" } */