Debian Codegraph @

gcc/testsuite/g++.dg/goacc/cache-2.C

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