1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -ferror-limit 100 -std=c++11 -o - %s -fopenmp-version=45 -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -fopenmp-version=50 -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -ferror-limit 100 -std=c++11 -o - %s -fopenmp-version=45 -Wuninitialized
6 // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
7 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp-simd -ferror-limit 100 -std=c++11 -o - %s -Wuninitialized
13 int x
; // expected-note {{initialize the variable 'x' to silence this warning}}
14 #pragma omp distribute parallel for
15 for (int i
= 0; i
< 10; ++i
)
16 argc
= x
; // expected-warning {{variable 'x' is uninitialized when used here}}
19 #pragma omp distribute parallel for // expected-error {{unexpected OpenMP directive '#pragma omp distribute parallel for'}}
21 int main(int argc
, char **argv
) {
22 #pragma omp distribute parallel for order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} expected-error {{expected '(' after 'order'}}
23 for (int i
= 0; i
< argc
; ++i
)
25 #pragma omp distribute parallel for order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
26 for (int i
= 0; i
< argc
; ++i
)
28 #pragma omp distribute parallel for order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
29 for (int i
= 0; i
< argc
; ++i
)
31 #pragma omp distribute parallel for order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
32 for (int i
= 0; i
< argc
; ++i
)
34 #pragma omp distribute parallel for order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}}
35 for (int i
= 0; i
< argc
; ++i
)
37 #pragma omp distribute parallel for order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}} omp51-error {{expected 'concurrent' in OpenMP clause 'order'}}
38 for (int i
= 0; i
< argc
; ++i
)
40 #pragma omp distribute parallel for order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
41 for (int i
= 0; i
< argc
; ++i
)
43 #pragma omp distribute parallel for order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
44 for (int i
= 0; i
< argc
; ++i
)
46 #pragma omp distribute parallel for order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
47 for (int i
= 0; i
< argc
; ++i
)
49 #pragma omp distribute parallel for order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp distribute parallel for'}} omp51-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'order' clause}}
50 for (int i
= 0; i
< argc
; ++i
)
54 #pragma omp distribute parallel for { // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
55 for (int i
= 0; i
< argc
; ++i
)
59 #pragma omp distribute parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
60 for (int i
= 0; i
< argc
; ++i
)
64 #pragma omp distribute parallel for[ // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
65 for (int i
= 0; i
< argc
; ++i
)
69 #pragma omp distribute parallel for] // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
70 for (int i
= 0; i
< argc
; ++i
)
74 #pragma omp distribute parallel for) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
75 for (int i
= 0; i
< argc
; ++i
)
79 #pragma omp distribute parallel for } // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
80 for (int i
= 0; i
< argc
; ++i
)
84 #pragma omp distribute parallel for linear(argc) // expected-error {{unexpected OpenMP clause 'linear' in directive '#pragma omp distribute parallel for'}}
85 for (int i
= 0; i
< argc
; ++i
)
89 #pragma omp distribute parallel for unknown() // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for' are ignored}}
90 for (int i
= 0; i
< argc
; ++i
)
93 for (int i
= 0; i
< argc
; ++i
)
97 #pragma omp distribute parallel for
98 for (int i
= 0; i
< argc
; ++i
)
102 #pragma omp distribute parallel for
103 for (int i
= 0; i
< argc
; ++i
) {
104 goto L1
; // expected-error {{use of undeclared label 'L1'}}
108 for (int i
= 0; i
< 10; ++i
) {
113 #pragma omp distribute parallel for
114 for (int i
= 0; i
< argc
; ++i
) {
116 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
125 #pragma omp distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
126 for (int i
= 0; i
< 10; ++i
)
127 ++argc
; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
129 goto L2
; // expected-error {{use of undeclared label 'L2'}}
132 #pragma omp distribute parallel for
133 for (int i
= 0; i
< argc
; ++i
)
138 #pragma omp distribute parallel for
139 for (int i
= 0; i
< argc
; ++i
) {
140 return 1; // expected-error {{cannot return from OpenMP region}}
143 [[]] // expected-error {{an attribute list cannot appear here}}
146 #pragma omp distribute parallel for
147 for (int n
= 0; n
< 100; ++n
) {
153 void test_ordered() {
156 #pragma omp distribute parallel for collapse(2) collapse(3) // expected-error {{directive '#pragma omp distribute parallel for' cannot contain more than one 'collapse' clause}}
157 for (int i
= 0; i
< 16; ++i
)
158 for (int j
= 0; j
< 16; ++j
)
165 #pragma omp distribute parallel for
166 for (int i
= 0; i
< 16; ++i
)
167 for (int j
= 0; j
< 16; ++j
) {
168 #pragma omp cancel for