c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / c-c++-common / gomp / scan-6.c
blob0fdf66bf80d723642b12cbb220ce693254f14336
1 void f1 (int, int, int);
2 int iii (int, int, int);
4 int
5 s1 (int a1, int a2, int a3)
7 int r = 0;
8 #pragma omp simd collapse(3) reduction (inscan, +:r)
9 for (int i = 0; i < a1; i++)
10 for (int j = 0; j < a2; j++)
11 for (int k = 0; k < a3; k++)
13 #pragma omp scan exclusive (r) /* { dg-warning "'#pragma omp scan' with zero preceding executable statements" } */
14 f1 (2, k, r);
17 #pragma omp simd collapse(3) reduction (inscan, +:r)
18 for (int i = 0; i < a1; i++)
19 for (int j = 0; j < a2; j++)
20 for (int k = 0; k < a3; k++)
22 r += iii (i, j, k);
23 #pragma omp scan exclusive (r) /* { dg-warning "'#pragma omp scan' with zero succeeding executable statements" } */
26 #pragma omp simd collapse(3) reduction (inscan, +:r)
27 for (int i = 0; i < a1; i++)
28 for (int j = 0; j < a2; j++)
29 for (int k = 0; k < a3; k++)
31 #pragma omp scan inclusive (r)
32 /* { dg-warning "'#pragma omp scan' with zero preceding executable statements" "" { target *-*-* } .-1 } */
33 /* { dg-warning "'#pragma omp scan' with zero succeeding executable statements" "" { target *-*-* } .-2 } */
35 return r;
38 int
39 s2 (int a1, int a2, int a3)
41 int r = 0;
42 #pragma omp simd collapse(3) reduction (inscan, +:r) /* { dg-error "'r' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
43 for (int i = 0; i < a1; i++)
44 for (int j = 0; j < a2; j++)
45 for (int k = 0; k < a3; k++)
47 f1 (2, k, r);
48 r += iii (i, j, k); /* { dg-error "expected '#pragma omp scan'" "" { target c++ } } */
49 } /* { dg-error "expected '#pragma omp scan'" "" { target c } } */
51 r = 0;
52 #pragma omp simd collapse(3) reduction (inscan, +:r) /* { dg-error "'r' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
53 for (int i = 0; i < a1; i++)
54 for (int j = 0; j < a2; j++)
55 for (int k = 0; k < a3; k++)
56 ; /* { dg-error "expected '\{' before ';' token" } */
58 #pragma omp simd collapse(3) reduction (inscan, +:r) /* { dg-error "'r' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
59 for (int i = 0; i < a1; i++)
60 for (int j = 0; j < a2; j++)
61 for (int k = 0; k < a3; k++)
63 } /* { dg-error "expected expression before '\}' token" "" { target c } } */
64 /* { dg-error "expected primary-expression before '\}' token" "" { target c++ } .-1 } */
65 /* { dg-error "expected '#pragma omp scan'" "" { target *-*-* } .-2 } */
68 r = 0;
69 #pragma omp simd collapse(3) reduction (inscan, +:r)
70 for (int i = 0; i < a1; i++)
71 for (int j = 0; j < a2; j++)
72 for (int k = 0; k < a3; k++)
74 f1 (2, k, r);
75 #pragma omp scan inclusive (r)
76 #pragma omp scan inclusive (r) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */
77 r += iii (i, j, k);
80 #pragma omp scan inclusive (r) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */
82 r = 0;
83 #pragma omp simd collapse(3) reduction (inscan, +:r) /* { dg-error "'r' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
84 for (int i = 0; i < a1; i++)
85 for (int j = 0; j < a2; j++)
86 for (int k = 0; k < a3; k++)
88 f1 (2, k, r);
90 #pragma omp scan inclusive (r) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */
92 r += iii (i, j, k); /* { dg-error "expected '#pragma omp scan'" "" { target c++ } } */
93 } /* { dg-error "expected '#pragma omp scan'" "" { target c } } */
94 return r;