c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / c-c++-common / gomp / scan-1.c
blob95b46cbb71b8bd1ca6ddf4716724b9fcd2c06525
1 int a, b;
3 void
4 f1 (void)
6 #pragma omp scan inclusive (a) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */
7 #pragma omp scan exclusive (b) /* { dg-error "'#pragma omp scan' may only be used in a loop construct with 'inscan' 'reduction' clause" } */
10 void
11 f2 (int *c, int *d, int *e, int *f)
13 int i, l = 1;
14 #pragma omp for reduction (inscan, +: a) reduction (+: b) /* { dg-error "'inscan' and non-'inscan' 'reduction' clauses on the same construct" } */
15 for (i = 0; i < 64; i++)
17 { b++; a += c[i]; }
18 #pragma omp scan inclusive (a) /* { dg-error "" } */
19 d[i] = a;
21 #pragma omp for reduction (+: a) reduction (inscan, +: b) /* { dg-error "'inscan' and non-'inscan' 'reduction' clauses on the same construct" } */
22 for (i = 0; i < 64; i++)
24 { a++; b += c[i]; }
25 #pragma omp scan inclusive (b) /* { dg-error "" } */
26 d[i] = b;
28 #pragma omp for reduction (inscan, +: e[:2]) /* { dg-error "'inscan' 'reduction' clause with array section" } */
29 for (i = 0; i < 64; ++i)
31 { e[0] += c[i]; e[1] += c[i]; }
32 #pragma omp scan inclusive (a, e[:2]) /* { dg-error "" } */
33 { d[i] = e[0]; f[i] = e[1]; }
35 #pragma omp for reduction (inscan, +: a) ordered /* { dg-error "'ordered' clause specified together with 'inscan' 'reduction' clause" } */
36 for (i = 0; i < 64; i++)
38 a += c[i];
39 #pragma omp scan inclusive (a) /* { dg-error "" } */
40 d[i] = a;
42 #pragma omp for reduction (inscan, +: a) ordered(1) /* { dg-error "'ordered' clause specified together with 'inscan' 'reduction' clause" } */
43 for (i = 0; i < 64; i++)
45 a += c[i];
46 #pragma omp scan inclusive (a) /* { dg-error "" } */
47 d[i] = a;
49 #pragma omp for reduction (inscan, +: a) schedule(static) /* { dg-error "'schedule' clause specified together with 'inscan' 'reduction' clause" } */
50 for (i = 0; i < 64; i++)
52 a += c[i];
53 #pragma omp scan inclusive (a) /* { dg-error "" } */
54 d[i] = a;
56 #pragma omp for reduction (inscan, +: a) schedule(static, 2) /* { dg-error "'schedule' clause specified together with 'inscan' 'reduction' clause" } */
57 for (i = 0; i < 64; i++)
59 a += c[i];
60 #pragma omp scan inclusive (a) /* { dg-error "" } */
61 d[i] = a;
63 #pragma omp for reduction (inscan, +: a) schedule(nonmonotonic: dynamic, 2) /* { dg-error "'schedule' clause specified together with 'inscan' 'reduction' clause" } */
64 for (i = 0; i < 64; i++)
66 a += c[i];
67 #pragma omp scan inclusive (a) /* { dg-error "" } */
68 d[i] = a;
70 #pragma omp for reduction (inscan, +: a) linear (l) /* { dg-error "'inscan' 'reduction' clause used together with 'linear' clause for a variable other than loop iterator" } */
71 for (i = 0; i < 64; i++)
73 { a += c[i]; ++l; }
74 #pragma omp scan inclusive (a)
75 d[i] = a;
79 void
80 f3 (int *c, int *d)
82 int i;
83 #pragma omp teams reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'teams' construct" } */
85 #pragma omp parallel reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'parallel' construct" } */
87 #pragma omp sections reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'sections' construct" } */
89 #pragma omp section
92 #pragma omp scope reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'scope' construct" } */
94 #pragma omp target parallel for reduction (inscan, +: a) map (c[:64], d[:64]) /* { dg-error "'inscan' 'reduction' clause on construct other than 'for', 'simd', 'for simd', 'parallel for', 'parallel for simd'" } */
95 for (i = 0; i < 64; i++)
97 d[i] = a;
98 #pragma omp scan exclusive (a) /* { dg-error "" } */
99 a += c[i];
101 #pragma omp teams
103 #pragma omp distribute parallel for reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on construct other than 'for', 'simd', 'for simd', 'parallel for', 'parallel for simd'" } */
104 for (i = 0; i < 64; i++)
106 d[i] = a;
107 #pragma omp scan exclusive (a) /* { dg-error "" } */
108 a += c[i];
110 #pragma omp distribute parallel for simd reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on construct other than 'for', 'simd', 'for simd', 'parallel for', 'parallel for simd'" } */
111 for (i = 0; i < 64; i++)
113 d[i] = a;
114 #pragma omp scan exclusive (a) /* { dg-error "" } */
115 a += c[i];
120 void
121 f4 (int *c, int *d)
123 int i;
124 #pragma omp taskloop reduction (inscan, +: a) /* { dg-error "'inscan' 'reduction' clause on 'taskloop' construct" } */
125 for (i = 0; i < 64; i++)
127 d[i] = a;
128 #pragma omp scan exclusive (a) /* { dg-error "" } */
129 a += c[i];
133 void
134 f5 (int *c, int *d)
136 int i;
137 #pragma omp simd reduction (inscan, +: a)
138 for (i = 0; i < 64; i++)
140 d[i] = a;
141 #pragma omp scan exclusive (a, b) /* { dg-error "'b' specified in 'exclusive' clause but not in 'inscan' 'reduction' clause on the containing construct" } */
142 a += c[i];
146 void
147 f6 (int *c, int *d)
149 int i;
150 #pragma omp simd reduction (inscan, +: a, b) /* { dg-error "'b' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
151 for (i = 0; i < 64; i++)
153 d[i] = a;
154 #pragma omp scan exclusive (a)
155 a += c[i];
159 void
160 f7 (void)
162 int i;
163 #pragma omp simd reduction (inscan, +: a)
164 for (i = 0; i < 64; i++)
166 if (i == 23) /* { dg-error "invalid exit from OpenMP structured block" "" { target c++ } .+1 } */
167 continue; /* { dg-error "invalid branch to/from OpenMP structured block" "" { target c } } */
168 else if (i == 27)
169 goto l1; /* { dg-error "invalid branch to/from OpenMP structured block" } */
170 #pragma omp scan exclusive (a)
172 l1: a = 0; /* { dg-error "jump to label 'l1'" "" { target c++ } } */
173 if (i == 33) /* { dg-error "invalid exit from OpenMP structured block" "" { target c++ } .+1 } */
174 continue; /* { dg-error "invalid branch to/from OpenMP structured block" "" { target c } } */
179 void
180 f8 (int *c, int *d, int *e, int *f)
182 int i;
183 #pragma omp for reduction (inscan, +: a, b) /* { dg-error "'b' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
184 for (i = 0; i < 64; i++)
186 { a += c[i]; b += d[i]; }
187 #pragma omp scan inclusive (a) inclusive (b) /* { dg-error "expected end of line before 'inclusive'" } */
188 { e[i] = a; f[i] = b; }
190 #pragma omp for reduction (inscan, +: a, b) /* { dg-error "'.' specified in 'inscan' 'reduction' clause but not in 'scan' directive clause" } */
191 for (i = 0; i < 64; i++)
193 { a += c[i]; b += d[i]; }
194 #pragma omp scan /* { dg-error "expected 'inclusive' or 'exclusive' clause before end of line" } */
195 { e[i] = a; f[i] = b; }
199 void
200 f9 (void)
202 int i;
203 #pragma omp simd reduction (inscan, +: a)
204 for (i = 0; i < 64; i++)
206 if (i == 23) /* { dg-error "invalid exit from OpenMP structured block" "" { target c++ } .+1 } */
207 break; /* { dg-error "break statement used with OpenMP for loop" "" { target c } } */
208 #pragma omp scan exclusive (a)
209 a++;