1 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -verify=expected,omp45 -std=c++11 %s -Wuninitialized
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -verify=expected,omp5,omp50 -std=c++11 %s -Wuninitialized
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -verify=expected,omp5,omp51 -std=c++11 %s -Wuninitialized
5 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 -std=c++11 %s -Wuninitialized
6 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -verify=expected,omp5,omp50 -std=c++11 %s -Wuninitialized
7 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -verify=expected,omp5,omp51 -std=c++11 %s -Wuninitialized
10 int x
; // expected-note {{initialize the variable 'x' to silence this warning}}
12 #pragma omp teams distribute parallel for simd
13 for (int i
= 0; i
< 10; ++i
)
14 argc
= x
; // expected-warning {{variable 'x' is uninitialized when used here}}
21 #pragma omp threadprivate(pvt)
23 #pragma omp teams distribute parallel for simd // expected-error {{unexpected OpenMP directive '#pragma omp teams distribute parallel for simd'}}
25 int main(int argc
, char **argv
) {
27 #pragma omp teams distribute parallel for simd
28 f
; // expected-error {{use of undeclared identifier 'f'}}
30 #pragma omp teams distribute parallel for simd { // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
31 for (int i
= 0; i
< argc
; ++i
)
34 #pragma omp teams distribute parallel for simd ( // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
35 for (int i
= 0; i
< argc
; ++i
)
38 #pragma omp teams distribute parallel for simd[ // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
39 for (int i
= 0; i
< argc
; ++i
)
42 #pragma omp teams distribute parallel for simd] // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
43 for (int i
= 0; i
< argc
; ++i
)
46 #pragma omp teams distribute parallel for simd) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
47 for (int i
= 0; i
< argc
; ++i
)
50 #pragma omp teams distribute parallel for simd } // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
51 for (int i
= 0; i
< argc
; ++i
)
54 #pragma omp teams distribute parallel for simd
55 for (int i
= 0; i
< argc
; ++i
)
57 // expected-warning@+2 {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
59 #pragma omp teams distribute parallel for simd unknown()
60 for (int i
= 0; i
< argc
; ++i
)
63 for (int i
= 0; i
< argc
; ++i
)
66 #pragma omp teams distribute parallel for simd
67 for (int i
= 0; i
< argc
; ++i
)
70 #pragma omp teams distribute parallel for simd
71 for (int i
= 0; i
< argc
; ++i
) {
72 goto L1
; // expected-error {{use of undeclared label 'L1'}}
76 for (int i
= 0; i
< 10; ++i
) {
80 #pragma omp teams distribute parallel for simd
81 for (int i
= 0; i
< argc
; ++i
) {
83 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
91 #pragma omp teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}
92 for (int i
= 0; i
< 10; ++i
)
93 ++argc
; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}}
95 goto L2
; // expected-error {{use of undeclared label 'L2'}}
97 #pragma omp teams distribute parallel for simd
98 for (int i
= 0; i
< argc
; ++i
)
102 #pragma omp teams distribute parallel for simd
103 for (int i
= 0; i
< argc
; ++i
) {
104 return 1; // expected-error {{cannot return from OpenMP region}}
107 [[]] // expected-error {{an attribute list cannot appear here}}
109 #pragma omp teams distribute parallel for simd
110 for (int n
= 0; n
< 100; ++n
) {
114 #pragma omp teams distribute parallel for simd copyin(pvt) // expected-error {{unexpected OpenMP clause 'copyin' in directive '#pragma omp teams distribute parallel for simd'}}
115 for (int n
= 0; n
< 100; ++n
) {}
120 void test_ordered() {
122 #pragma omp teams distribute parallel for simd ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp teams distribute parallel for simd'}}
123 for (int i
= 0; i
< 16; ++i
)
127 void test_nontemporal() {
130 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
131 #pragma omp teams distribute parallel for simd nontemporal(
132 for (i
= 0; i
< 16; ++i
)
135 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 2 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
136 #pragma omp teams distribute parallel for simd nontemporal(,
137 for (i
= 0; i
< 16; ++i
)
140 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 2 {{expected expression}}
141 #pragma omp teams distribute parallel for simd nontemporal(, )
142 for (i
= 0; i
< 16; ++i
)
145 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 {{expected expression}}
146 #pragma omp teams distribute parallel for simd nontemporal()
147 for (i
= 0; i
< 16; ++i
)
150 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 {{expected '(' for function-style cast or type construction}}
151 #pragma omp teams distribute parallel for simd nontemporal(int)
152 for (i
= 0; i
< 16; ++i
)
155 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} omp5-error@+1 {{expected variable name}}
156 #pragma omp teams distribute parallel for simd nontemporal(0)
157 for (i
= 0; i
< 16; ++i
)
160 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 {{use of undeclared identifier 'x'}}
161 #pragma omp teams distribute parallel for simd nontemporal(x)
162 for (i
= 0; i
< 16; ++i
)
165 // expected-error@+2 {{use of undeclared identifier 'x'}}
166 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 {{use of undeclared identifier 'y'}}
167 #pragma omp teams distribute parallel for simd nontemporal(x, y)
168 for (i
= 0; i
< 16; ++i
)
171 // expected-error@+3 {{use of undeclared identifier 'x'}}
172 // expected-error@+2 {{use of undeclared identifier 'y'}}
173 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 {{use of undeclared identifier 'z'}}
174 #pragma omp teams distribute parallel for simd nontemporal(x, y, z)
175 for (i
= 0; i
< 16; ++i
)
180 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
181 #pragma omp teams distribute parallel for simd nontemporal(x :)
182 for (i
= 0; i
< 16; ++i
)
185 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}}
186 #pragma omp teams distribute parallel for simd nontemporal(x :, )
187 for (i
= 0; i
< 16; ++i
)
191 // omp5-note@+2 {{defined as nontemporal}}
192 // omp45-error@+1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} omp5-error@+1 {{a variable cannot appear in more than one nontemporal clause}}
193 #pragma omp teams distribute parallel for simd nontemporal(x) nontemporal(x)
194 for (i
= 0; i
< 16; ++i
)
198 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}}
199 #pragma omp teams distribute parallel for simd private(x) nontemporal(x)
200 for (i
= 0; i
< 16; ++i
)
204 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}}
205 #pragma omp teams distribute parallel for simd nontemporal(x) private(x)
206 for (i
= 0; i
< 16; ++i
)
210 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-note@+1 {{to match this '('}} expected-error@+1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error@+1 {{expected ')'}}
211 #pragma omp teams distribute parallel for simd nontemporal(x, y : 0)
212 for (i
= 0; i
< 16; ++i
)
216 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}}
217 #pragma omp teams distribute parallel for simd nontemporal(x) lastprivate(x)
218 for (i
= 0; i
< 16; ++i
)
222 // omp45-error@+1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}}
223 #pragma omp teams distribute parallel for simd lastprivate(x) nontemporal(x)
224 for (i
= 0; i
< 16; ++i
)
227 #pragma omp teams distribute parallel for simd order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} expected-error {{expected '(' after 'order'}}
228 for (int i
= 0; i
< 10; ++i
)
231 #pragma omp teams distribute parallel for simd order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}
232 for (int i
= 0; i
< 10; ++i
)
235 #pragma omp teams distribute parallel for simd order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}
236 for (int i
= 0; i
< 10; ++i
)
239 #pragma omp teams distribute parallel for simd order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
240 for (int i
= 0; i
< 10; ++i
)
243 #pragma omp teams distribute parallel for simd order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}}
244 for (int i
= 0; i
< 10; ++i
)
247 #pragma omp teams distribute parallel for simd order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}
248 for (int i
= 0; i
< 10; ++i
)
251 #pragma omp teams distribute parallel for simd order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
252 for (int i
= 0; i
< 10; ++i
)
255 #pragma omp teams distribute parallel for simd order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
256 for (int i
= 0; i
< 10; ++i
)
259 #pragma omp teams distribute parallel for simd order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
260 for (int i
= 0; i
< 10; ++i
)
263 #pragma omp teams distribute parallel for simd order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for simd'}} omp51-error {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'order' clause}}
264 for (int i
= 0; i
< 10; ++i
)