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 -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 -std=c++11 %s -Wuninitialized
10 int x
; // expected-note {{initialize the variable 'x' to silence this warning}}
11 #pragma omp target teams distribute parallel for
12 for (int i
= 0; i
< 10; ++i
)
13 argc
= x
; // expected-warning {{variable 'x' is uninitialized when used here}}
20 #pragma omp threadprivate(pvt)
22 #pragma omp target teams distribute parallel for // expected-error {{unexpected OpenMP directive '#pragma omp target teams distribute parallel for'}}
24 int main(int argc
, char **argv
) {
25 #pragma omp target teams distribute parallel for { // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
26 for (int i
= 0; i
< argc
; ++i
)
28 #pragma omp target teams distribute parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
29 for (int i
= 0; i
< argc
; ++i
)
31 #pragma omp target teams distribute parallel for[ // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
32 for (int i
= 0; i
< argc
; ++i
)
34 #pragma omp target teams distribute parallel for] // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
35 for (int i
= 0; i
< argc
; ++i
)
37 #pragma omp target teams distribute parallel for) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
38 for (int i
= 0; i
< argc
; ++i
)
40 #pragma omp target teams distribute parallel for } // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
41 for (int i
= 0; i
< argc
; ++i
)
43 #pragma omp target teams distribute parallel for linear(argc) // expected-error {{unexpected OpenMP clause 'linear' in directive '#pragma omp target teams distribute parallel for'}}
44 for (int i
= 0; i
< argc
; ++i
)
46 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
47 #pragma omp target teams distribute parallel for unknown()
48 for (int i
= 0; i
< argc
; ++i
)
51 for (int i
= 0; i
< argc
; ++i
)
53 #pragma omp target teams distribute parallel for
54 for (int i
= 0; i
< argc
; ++i
)
56 #pragma omp target teams distribute parallel for
57 for (int i
= 0; i
< argc
; ++i
) {
58 goto L1
; // expected-error {{use of undeclared label 'L1'}}
62 for (int i
= 0; i
< 10; ++i
) {
65 #pragma omp target teams distribute parallel for
66 for (int i
= 0; i
< argc
; ++i
) {
68 break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
75 #pragma omp target teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
76 for (int i
= 0; i
< 10; ++i
)
77 ++argc
; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}}
79 goto L2
; // expected-error {{use of undeclared label 'L2'}}
80 #pragma omp target teams distribute parallel for
81 for (int i
= 0; i
< argc
; ++i
)
84 #pragma omp target teams distribute parallel for
85 for (int i
= 0; i
< argc
; ++i
) {
86 return 1; // expected-error {{cannot return from OpenMP region}}
89 [[]] // expected-error {{an attribute list cannot appear here}}
90 #pragma omp target teams distribute parallel for
91 for (int n
= 0; n
< 100; ++n
) {
94 #pragma omp target teams distribute parallel for copyin(pvt) // expected-error {{unexpected OpenMP clause 'copyin' in directive '#pragma omp target teams distribute parallel for'}}
95 for (int n
= 0; n
< 100; ++n
) {}
100 void test_ordered() {
101 #pragma omp target teams distribute parallel for ordered // expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp target teams distribute parallel for'}}
102 for (int i
= 0; i
< 16; ++i
)
104 #pragma omp target teams distribute parallel for order // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected '(' after 'order'}}
105 for (int i
= 0; i
< 10; ++i
)
107 #pragma omp target teams distribute parallel for order( // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}
108 for (int i
= 0; i
< 10; ++i
)
110 #pragma omp target teams distribute parallel for order(none // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}
111 for (int i
= 0; i
< 10; ++i
)
113 #pragma omp target teams distribute parallel for order(concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
114 for (int i
= 0; i
< 10; ++i
)
116 #pragma omp target teams distribute parallel for order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}}
117 for (int i
= 0; i
< 10; ++i
)
119 #pragma omp target teams distribute parallel for order(unconstrained:) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp5-error {{expected 'concurrent' in OpenMP clause 'order'}}
120 for (int i
= 0; i
< 10; ++i
)
122 #pragma omp target teams distribute parallel for order(reproducible:concurrent // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
123 for (int i
= 0; i
< 10; ++i
)
125 #pragma omp target teams distribute parallel for order(reproducible:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
126 for (int i
= 0; i
< 10; ++i
)
128 #pragma omp target teams distribute parallel for order(unconstrained:concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
129 for (int i
= 0; i
< 10; ++i
)
131 #pragma omp target teams distribute parallel for order(concurrent) order(concurrent) // omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp45-error {{unexpected OpenMP clause 'order' in directive '#pragma omp target teams distribute parallel for'}} omp51-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'order' clause}}
132 for (int i
= 0; i
< 10; ++i
)