1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
8 int x
; // expected-note {{initialize the variable 'x' to silence this warning}}
10 argc
= x
; // expected-warning {{variable 'x' is uninitialized when used here}}
13 template<typename T
, int N
>
14 int tmain(int argc
, char **argv
) { // expected-note {{declared here}}
17 #pragma omp critical untied allocate(argc) // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp critical'}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp critical'}}
18 #pragma omp critical unknown // expected-warning {{extra tokens at the end of '#pragma omp critical' are ignored}}
19 #pragma omp critical ( // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}}
20 #pragma omp critical ( + // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}}
21 #pragma omp critical (name2 // expected-error {{expected ')'}} expected-note {{to match this '('}}
22 #pragma omp critical (name1)
26 } // expected-error {{expected statement}}
27 #pragma omp critical (name2) // expected-note {{previous 'critical' region starts here}}
29 for (int i
= 0; i
< 10; ++i
) {
33 for (int j
= 0; j
< 10; j
++) {
35 #pragma omp critical(name2) // expected-error {{cannot nest 'critical' regions having the same name 'name2'}}
39 #pragma omp critical (name2)
41 for (int i
= 0; i
< 10; ++i
) {
45 for (int j
= 0; j
< 10; j
++) {
50 #pragma omp critical (name2)
52 for (int i
= 0; i
< 10; ++i
) {
56 for (int j
= 0; j
< 10; j
++) {
57 #pragma omp critical (nam)
62 #pragma omp critical (name2) hint // expected-error {{expected '(' after 'hint'}}
64 #pragma omp critical (name2) hint( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
66 #pragma omp critical (name2) hint(+ // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
68 #pragma omp critical (name2) hint(argc) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
70 #pragma omp critical (name) hint(N) // expected-error {{argument to 'hint' clause must be a non-negative integer value}} expected-error {{constructs with the same name must have a 'hint' clause with the same value}} expected-note {{'hint' clause with value '4'}}
72 #pragma omp critical hint(N) // expected-error {{the name of the construct must be specified in presence of 'hint' clause}}
75 const int omp_lock_hint_none
= 0;
76 #pragma omp critical (name3) hint(omp_lock_hint_none)
81 int main(int argc
, char **argv
) { // expected-note {{declared here}}
84 #pragma omp critical untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp critical'}}
85 #pragma omp critical unknown // expected-warning {{extra tokens at the end of '#pragma omp critical' are ignored}}
86 #pragma omp critical ( // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}}
87 #pragma omp critical ( + // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}}
88 #pragma omp critical (name2 // expected-error {{expected ')'}} expected-note {{to match this '('}}
89 #pragma omp critical (name1)
93 } // expected-error {{expected statement}}
94 #pragma omp critical (name2) // expected-note {{previous 'critical' region starts here}}
96 for (int i
= 0; i
< 10; ++i
) {
100 for (int j
= 0; j
< 10; j
++) {
102 #pragma omp critical(name2) // expected-error {{cannot nest 'critical' regions having the same name 'name2'}}
106 #pragma omp critical (name2)
108 for (int i
= 0; i
< 10; ++i
) {
112 for (int j
= 0; j
< 10; j
++) {
117 #pragma omp critical (name2)
119 for (int i
= 0; i
< 10; ++i
) {
123 for (int j
= 0; j
< 10; j
++) {
124 #pragma omp critical (nam)
129 #pragma omp critical (name2) hint // expected-error {{expected '(' after 'hint'}}
131 #pragma omp critical (name2) hint( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
133 #pragma omp critical (name2) hint(+ // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
135 #pragma omp critical (name2) hint(argc) // expected-error {{integral constant expression}} expected-note 0+{{constant expression}}
137 #pragma omp critical (name) hint(23) // expected-note {{previous 'hint' clause with value '23'}}
139 #pragma omp critical hint(-5) // expected-error {{argument to 'hint' clause must be a non-negative integer value}}
141 #pragma omp critical hint(1) // expected-error {{the name of the construct must be specified in presence of 'hint' clause}}
143 return tmain
<int, 4>(argc
, argv
) + tmain
<float, -5>(argc
, argv
); // expected-note {{in instantiation of function template specialization 'tmain<float, -5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}}
147 L1
: // expected-note {{jump exits scope of OpenMP structured block}}
152 goto L1
; // expected-error {{cannot jump from this goto statement to its label}}
154 goto L2
; // expected-error {{cannot jump from this goto statement to its label}}
156 { // expected-note {{jump bypasses OpenMP structured block}}