ordered_messages.cpp
15.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++98 -o - %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
#pragma omp for ordered
for (int i = 0; i < 10; ++i) {
#pragma omp ordered
argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}
}
}
int foo();
template <class T>
T foo() {
T k;
#pragma omp for ordered
for (int i = 0; i < 10; ++i) {
L1:
foo();
#pragma omp ordered
{
foo();
goto L1; // expected-error {{use of undeclared label 'L1'}}
}
}
#pragma omp for ordered
for (int i = 0; i < 10; ++i) {
foo();
goto L2; // expected-error {{use of undeclared label 'L2'}}
#pragma omp ordered
{
L2:
foo();
}
}
#pragma omp for ordered
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads threads // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'threads' clause}}
{
foo();
}
}
#pragma omp for ordered(1) // expected-note {{'ordered' clause with specified parameter}}
for (int i = 0; i < 10; ++i) {
#pragma omp ordered // expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}}
{
foo();
}
}
#pragma omp for ordered(1) // expected-note {{'ordered' clause with specified parameter}}
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads // expected-error {{'ordered' directive with 'threads' clause cannot be closely nested inside ordered region with specified parameter}}
{
foo();
}
}
#pragma omp ordered simd simd // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'simd' clause}}
{
foo();
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp for simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp for simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp parallel for simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp parallel for simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
#pragma omp ordered depend(source) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
}
#pragma omp parallel for ordered
for (int i = 0; i < 10; ++i) {
#pragma omp ordered depend(source) // expected-error {{'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter}}
#pragma omp ordered depend(sink : i) // expected-error {{'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter}}
}
#pragma omp parallel for ordered(2) // expected-note 5 {{'ordered' clause with specified parameter}}
for (int i = 0; i < 10; ++i) {
for (int j = 0; j < 10; ++j) {
#pragma omp ordered depend // expected-error {{expected '(' after 'depend'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}}
#pragma omp ordered depend( // expected-error {{expected ')'}} expected-error {{expected 'source' or 'sink' in OpenMP clause 'depend'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}} expected-warning {{missing ':' or ')' after dependency type - ignoring}} expected-note {{to match this '('}}
#pragma omp ordered depend(source // expected-error {{expected ')'}} expected-note {{to match this '('}}
#pragma omp ordered depend(sink // expected-error {{expected expression}} expected-warning {{missing ':' or ')' after dependency type - ignoring}} expected-error {{expected ')'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}} expected-note {{to match this '('}}
#pragma omp ordered depend(sink : // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}}
#pragma omp ordered depend(sink : i // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'j' loop iteration variable}}
#pragma omp ordered depend(sink : i) // expected-error {{expected 'j' loop iteration variable}}
#pragma omp ordered depend(source)
if (i == j)
#pragma omp ordered depend(source) // expected-error {{'#pragma omp ordered' with 'depend' clause cannot be an immediate substatement}}
;
if (i == j)
#pragma omp ordered depend(sink : i, j) // expected-error {{'#pragma omp ordered' with 'depend' clause cannot be an immediate substatement}}
;
#pragma omp ordered depend(source) threads // expected-error {{'depend' clauses cannot be mixed with 'threads' clause}}
#pragma omp ordered simd depend(source) // expected-error {{'depend' clauses cannot be mixed with 'simd' clause}}
#pragma omp ordered depend(source) depend(source) // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'depend' clause with 'source' dependence}}
#pragma omp ordered depend(in : i) // expected-error {{expected 'source' or 'sink' in OpenMP clause 'depend'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}}
#pragma omp ordered depend(sink : i, j)
#pragma omp ordered depend(sink : j, i) // expected-error {{expected 'i' loop iteration variable}} expected-error {{expected 'j' loop iteration variable}}
#pragma omp ordered depend(sink : i, j, k) // expected-error {{unexpected expression: number of expressions is larger than the number of associated loops}}
#pragma omp ordered depend(sink : i+foo(), j/4) // expected-error {{expression is not an integral constant expression}} expected-error {{expected '+' or '-' operation}}
#if __cplusplus >= 201103L
// expected-note@-2 {{non-constexpr function 'foo' cannot be used in a constant expression}}
#endif
#pragma omp ordered depend(sink : i*0, j-4)// expected-error {{expected '+' or '-' operation}}
#pragma omp ordered depend(sink : i-0, j+sizeof(T)) depend(sink : i-0, j+sizeof(T))
#pragma omp ordered depend(sink : i-0, j+sizeof(T)) depend(source) // expected-error {{'depend(source)' clause cannot be mixed with 'depend(sink:vec)' clauses}}
#pragma omp ordered depend(source) depend(sink : i-0, j+sizeof(T)) // expected-error {{'depend(sink:vec)' clauses cannot be mixed with 'depend(source)' clause}}
}
}
#pragma omp ordered depend(source) // expected-error {{'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter}}
#pragma omp ordered depend(sink:k) // expected-error {{'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter}}
return T();
}
int foo() {
#if __cplusplus >= 201103L
// expected-note@-2 2 {{declared here}}
#endif
int k;
#pragma omp for ordered
for (int i = 0; i < 10; ++i) {
L1:
foo();
#pragma omp ordered
{
foo();
goto L1; // expected-error {{use of undeclared label 'L1'}}
}
}
#pragma omp for ordered
for (int i = 0; i < 10; ++i) {
foo();
goto L2; // expected-error {{use of undeclared label 'L2'}}
#pragma omp ordered
{
L2:
foo();
}
}
#pragma omp for ordered
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads threads // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'threads' clause}}
{
foo();
}
}
#pragma omp for ordered(1) // expected-note {{'ordered' clause with specified parameter}}
for (int i = 0; i < 10; ++i) {
#pragma omp ordered // expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}}
{
foo();
}
}
#pragma omp for ordered(1) // expected-note {{'ordered' clause with specified parameter}}
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads // expected-error {{'ordered' directive with 'threads' clause cannot be closely nested inside ordered region with specified parameter}}
{
foo();
}
}
#pragma omp ordered simd simd // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'simd' clause}}
{
foo();
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp for simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp for simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp parallel for simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
}
#pragma omp parallel for simd
for (int i = 0; i < 10; ++i) {
#pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}}
{
foo();
}
#pragma omp ordered depend(source) // expected-error {{OpenMP constructs may not be nested inside a simd region}}
}
#pragma omp parallel for ordered
for (int i = 0; i < 10; ++i) {
#pragma omp ordered depend(source) // expected-error {{'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter}}
#pragma omp ordered depend(sink : i) // expected-error {{'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter}}
}
#pragma omp parallel for ordered(2) // expected-note 5 {{'ordered' clause with specified parameter}}
for (int i = 0; i < 10; ++i) {
for (int j = 0; j < 10; ++j) {
#pragma omp ordered depend // expected-error {{expected '(' after 'depend'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}}
#pragma omp ordered depend( // expected-error {{expected ')'}} expected-error {{expected 'source' or 'sink' in OpenMP clause 'depend'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}} expected-warning {{missing ':' or ')' after dependency type - ignoring}} expected-note {{to match this '('}}
#pragma omp ordered depend(source // expected-error {{expected ')'}} expected-note {{to match this '('}}
#pragma omp ordered depend(sink // expected-error {{expected expression}} expected-warning {{missing ':' or ')' after dependency type - ignoring}} expected-error {{expected ')'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}} expected-note {{to match this '('}}
#pragma omp ordered depend(sink : // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}}
#pragma omp ordered depend(sink : i // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'j' loop iteration variable}}
#pragma omp ordered depend(sink : i) // expected-error {{expected 'j' loop iteration variable}}
#pragma omp ordered depend(source)
if (i == j)
#pragma omp ordered depend(source) // expected-error {{'#pragma omp ordered' with 'depend' clause cannot be an immediate substatement}}
;
if (i == j)
#pragma omp ordered depend(sink : i, j) // expected-error {{'#pragma omp ordered' with 'depend' clause cannot be an immediate substatement}}
;
#pragma omp ordered depend(source) threads // expected-error {{'depend' clauses cannot be mixed with 'threads' clause}}
#pragma omp ordered simd depend(source) // expected-error {{'depend' clauses cannot be mixed with 'simd' clause}}
#pragma omp ordered depend(source) depend(source) // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'depend' clause with 'source' dependence}}
#pragma omp ordered depend(in : i) // expected-error {{expected 'source' or 'sink' in OpenMP clause 'depend'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}}
#pragma omp ordered depend(sink : i, j) allocate(i) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp ordered'}}
#pragma omp ordered depend(sink : j, i) // expected-error {{expected 'i' loop iteration variable}} expected-error {{expected 'j' loop iteration variable}}
#pragma omp ordered depend(sink : i, j, k) // expected-error {{unexpected expression: number of expressions is larger than the number of associated loops}}
#pragma omp ordered depend(sink : i+foo(), j/4) // expected-error {{expression is not an integral constant expression}} expected-error {{expected '+' or '-' operation}}
#if __cplusplus >= 201103L
// expected-note@-2 {{non-constexpr function 'foo' cannot be used in a constant expression}}
#endif
#pragma omp ordered depend(sink : i*0, j-4)// expected-error {{expected '+' or '-' operation}}
#pragma omp ordered depend(sink : i-0, j+sizeof(int)) depend(sink : i-0, j+sizeof(int))
#pragma omp ordered depend(sink : i-0, j+sizeof(int)) depend(source) // expected-error {{'depend(source)' clause cannot be mixed with 'depend(sink:vec)' clauses}}
#pragma omp ordered depend(source) depend(sink : i-0, j+sizeof(int)) // expected-error {{'depend(sink:vec)' clauses cannot be mixed with 'depend(source)' clause}}
}
}
#pragma omp for ordered(2) // expected-note {{as specified in 'ordered' clause}}
for (int i = 0; i < 10; ++i) { // expected-error {{expected 2 for loops after '#pragma omp for', but found only 1}}
#pragma omp ordered depend(sink : i)
int j;
#pragma omp ordered depend(sink : i, j) // expected-error {{expected loop iteration variable}}
foo();
}
return foo<int>(); // expected-note {{in instantiation of function template specialization 'foo<int>' requested here}}
}