OpenACC cache directive maintenance.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c++ / cache-1.C
blobeb94a685189b13e090325d4956e4c6fed46a849c
1 /* { dg-do compile } */
3 #include <stdlib.h>
5 int
6 main (int argc, char **argv)
8 #define N   2
9     int a[N], b[N];
10     int i;
12     for (i = 0; i < N; i++)
13     {
14         a[i] = 3;
15         b[i] = 0;
16     }
18 #pragma acc parallel copyin (a[0:N]) copyout (b[0:N])
20     int ii;
22     for (ii = 0; ii < N; ii++)
23     {
24         const int idx = ii;
25         int n = 1;
26         const int len = n;
28 #pragma acc cache /* { dg-error "error: expected '\\(' before end of line" } */
30 #pragma acc cache (a) /* { dg-error "error: expected '\\\['" } */
32 #pragma acc cache (a[0:N]) copyin (a[0:N]) /* { dg-error "error: expected end of line before 'copyin'" } */
34 #pragma acc cache () /* { dg-error "error: expected unqualified-id before '\\)' token" } */
36 #pragma acc cache (a[0:N] b[0:N}) /* { dg-error "error: expected end of line before '\\\}' token|error: expected '\\)' before 'b'" } */
38         b[ii] = a[ii];
39     }
43     for (i = 0; i < N; i++)
44     {
45         if (a[i] != b[i])
46             abort ();
47     }
49     return 0;