1 /* OpenACC 'cache' directive: invalid usage. */
2
3 /* See also corresponding C++ variant: '../../g++.dg/goacc/cache-2.C'. */
4
5 static void
test()6 test ()
7 {
8 #define N 2
9 int a[N], b[N];
10 int i;
11
12 for (i = 0; i < N; i++)
13 {
14 a[i] = 3;
15 b[i] = 0;
16 }
17
18 #pragma acc parallel copyin (a[0:N]) copyout (b[0:N])
19 {
20 int ii;
21
22 for (ii = 0; ii < N; ii++)
23 {
24 const int idx = ii;
25 int n = 1;
26 const int len = n;
27
28 #pragma acc cache /* { dg-error "expected '\\\(' before end of line" } */
29 #pragma acc cache a[0:N] /* { dg-error "expected '\\\(' before 'a'" } */
30 /* { dg-bogus "expected end of line before 'a'" "" { xfail c++ } .-1 } */
31 #pragma acc cache (a) /* { dg-error "expected '\\\['" } */
32 #pragma acc cache ( /* { dg-error "expected (identifier|unqualified-id) before end of line" } */
33 #pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */
34 #pragma acc cache (,) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" } */
35 #pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */
36 #pragma acc cache (a[0:N],) /* { dg-error "expected (identifier|unqualified-id) before '(,|\\\))' token" "" { xfail c } } */
37 #pragma acc cache (a[0:N]) copyin (a[0:N]) /* { dg-error "expected end of line before 'copyin'" } */
38 #pragma acc cache () /* { dg-error "expected (identifier|unqualified-id) before '\\\)' token" } */
39 #pragma acc cache (a[0:N] b[0:N]) /* { dg-error "expected '\\\)' before 'b'" } */
40 #pragma acc cache (a[0:N] b[0:N}) /* { dg-error "expected '\\\)' before 'b'" } */
41 /* { dg-bogus "expected end of line before '\\\}' token" "" { xfail c++ } .-1 } */
42 #pragma acc cache (a[0:N] /* { dg-error "expected '\\\)' before end of line" } */
43 #pragma acc cache (a[0:N]) ( /* { dg-error "expected end of line before '\\(' token" } */
44 #pragma acc cache (a[0:N]) ii /* { dg-error "expected end of line before 'ii'" } */
45 #pragma acc cache (a[0:N] ii) /* { dg-error "expected '\\)' before 'ii'" } */
46
47 b[ii] = a[ii];
48 }
49 }
50
51
52 for (i = 0; i < N; i++)
53 {
54 if (a[i] != b[i])
55 __builtin_abort ();
56 }
57 }
58