1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -std=c++11 %s -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp5,omp50 -fopenmp -fopenmp-version=50 -std=c++11 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify=expected,omp5,omp51 -fopenmp -fopenmp-version=51 -std=c++11 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -std=c++11 %s -Wuninitialized
6 // RUN: %clang_cc1 -verify=expected,omp5,omp50 -fopenmp-simd -fopenmp-version=50 -std=c++11 %s -Wuninitialized
7 // RUN: %clang_cc1 -verify=expected,omp5,omp51 -fopenmp-simd -fopenmp-version=51 -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
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 // expected-error {{unexpected OpenMP directive '#pragma omp teams distribute parallel for'}}
25 int main(int argc
, char **argv
) {
27 #pragma omp teams distribute parallel for
28 f
; // expected-error {{use of undeclared identifier 'f'}}
30 #pragma omp teams distribute parallel for { // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
31 for (int i
= 0; i
< argc
; ++i
)
34 #pragma omp teams distribute parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
35 for (int i
= 0; i
< argc
; ++i
)
38 #pragma omp teams distribute parallel for[ // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
39 for (int i
= 0; i
< argc
; ++i
)
42 #pragma omp teams distribute parallel for] // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
43 for (int i
= 0; i
< argc
; ++i
)
46 #pragma omp teams distribute parallel for) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
47 for (int i
= 0; i
< argc
; ++i
)
50 #pragma omp teams distribute parallel for } // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
51 for (int i
= 0; i
< argc
; ++i
)
54 #pragma omp teams distribute parallel for linear(argc) // expected-error {{unexpected OpenMP clause 'linear' in directive '#pragma omp teams distribute parallel for'}}
55 for (int i
= 0; i
< argc
; ++i
)
57 // expected-warning@+2 {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
59 #pragma omp teams distribute parallel for unknown()
60 for (int i
= 0; i
< argc
; ++i
)
63 for (int i
= 0; i
< argc
; ++i
)
66 #pragma omp teams distribute parallel for
67 for (int i
= 0; i
< argc
; ++i
)
70 #pragma omp teams distribute parallel for
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
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 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
98 for (int i
= 0; i
< argc
; ++i
)
102 #pragma omp teams distribute parallel for
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
110 for (int n
= 0; n
< 100; ++n
) {
114 #pragma omp teams distribute parallel for copyin(pvt)
115 for (int n
= 0; n
< 100; ++n
) {}
120 void test_ordered() {
122 #pragma omp teams distribute parallel for ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp teams distribute parallel for'}}
123 for (int i
= 0; i
< 16; ++i
)
126 #pragma omp teams distribute parallel for order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} expected-error {{expected '(' after 'order'}}
127 for (int i
= 0; i
< 10; ++i
)
130 #pragma omp teams distribute parallel for order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}
131 for (int i
= 0; i
< 10; ++i
)
134 #pragma omp teams distribute parallel for order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}
135 for (int i
= 0; i
< 10; ++i
)
138 #pragma omp teams distribute parallel for order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
139 for (int i
= 0; i
< 10; ++i
)
142 #pragma omp teams distribute parallel for order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}}
143 for (int i
= 0; i
< 10; ++i
)
146 #pragma omp teams distribute parallel for order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}
147 for (int i
= 0; i
< 10; ++i
)
150 #pragma omp teams distribute parallel for order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
151 for (int i
= 0; i
< 10; ++i
)
154 #pragma omp teams distribute parallel for order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
155 for (int i
= 0; i
< 10; ++i
)
158 #pragma omp teams distribute parallel for order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
159 for (int i
= 0; i
< 10; ++i
)
162 #pragma omp teams distribute parallel for order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp teams distribute parallel for'}} omp51-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'order' clause}}
163 for (int i
= 0; i
< 10; ++i
)
169 #pragma omp teams distribute parallel for
170 for (int i
= 0; i
< 16; ++i
) {
171 #pragma omp cancel for