1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
6 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
11 bool foobool(int argc
) {
16 int cond
; // expected-note {{initialize the variable 'cond' to silence this warning}}
18 #pragma omp teams distribute parallel for if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}}
19 for (int i
= 0; i
< 10; ++i
)
23 struct S1
; // expected-note {{declared here}}
25 template <class T
, class S
> // expected-note {{declared here}}
26 int tmain(T argc
, S
**argv
) {
29 #pragma omp teams distribute parallel for if // expected-error {{expected '(' after 'if'}}
30 for (i
= 0; i
< argc
; ++i
) foo();
32 #pragma omp teams distribute parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
33 for (i
= 0; i
< argc
; ++i
) foo();
35 #pragma omp teams distribute parallel for if () // expected-error {{expected expression}}
36 for (i
= 0; i
< argc
; ++i
) foo();
38 #pragma omp teams distribute parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
39 for (i
= 0; i
< argc
; ++i
) foo();
41 #pragma omp teams distribute parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
42 for (i
= 0; i
< argc
; ++i
) foo();
44 #pragma omp teams distribute parallel for if (argc > 0 ? argv[1] : argv[2])
45 for (i
= 0; i
< argc
; ++i
) foo();
47 #pragma omp teams distribute parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'if' clause}}
48 for (i
= 0; i
< argc
; ++i
) foo();
50 #pragma omp teams distribute parallel for if (S) // expected-error {{'S' does not refer to a value}}
51 for (i
= 0; i
< argc
; ++i
) foo();
53 #pragma omp teams distribute parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
54 for (i
= 0; i
< argc
; ++i
) foo();
56 #pragma omp teams distribute parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
57 for (i
= 0; i
< argc
; ++i
) foo();
59 #pragma omp teams distribute parallel for if(argc+z)
60 for (i
= 0; i
< argc
; ++i
) foo();
62 #pragma omp teams distribute parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
63 for (i
= 0; i
< argc
; ++i
) foo();
65 #pragma omp teams distribute parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
66 for (i
= 0; i
< argc
; ++i
) foo();
68 #pragma omp teams distribute parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
69 for (i
= 0; i
< argc
; ++i
) foo();
71 #pragma omp teams distribute parallel for if(parallel : argc)
72 for (i
= 0; i
< argc
; ++i
) foo();
74 #pragma omp teams distribute parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp teams distribute parallel for'}}
75 for (i
= 0; i
< argc
; ++i
) foo();
77 #pragma omp teams distribute parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}}
78 for (i
= 0; i
< argc
; ++i
) foo();
80 #pragma omp teams distribute parallel for if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
81 for (i
= 0; i
< argc
; ++i
) foo();
83 #pragma omp teams distribute parallel for if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp teams distribute parallel for'}}
84 for (i
= 0; i
< argc
; ++i
) foo();
89 int main(int argc
, char **argv
) {
92 #pragma omp teams distribute parallel for if // expected-error {{expected '(' after 'if'}}
93 for (i
= 0; i
< argc
; ++i
) foo();
95 #pragma omp teams distribute parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
96 for (i
= 0; i
< argc
; ++i
) foo();
98 #pragma omp teams distribute parallel for if () // expected-error {{expected expression}}
99 for (i
= 0; i
< argc
; ++i
) foo();
101 #pragma omp teams distribute parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
102 for (i
= 0; i
< argc
; ++i
) foo();
104 #pragma omp teams distribute parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
105 for (i
= 0; i
< argc
; ++i
) foo();
107 #pragma omp teams distribute parallel for if (argc > 0 ? argv[1] : argv[2])
108 for (i
= 0; i
< argc
; ++i
) foo();
110 #pragma omp teams distribute parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'if' clause}}
111 for (i
= 0; i
< argc
; ++i
) foo();
113 #pragma omp teams distribute parallel for if (S1) // expected-error {{'S1' does not refer to a value}}
114 for (i
= 0; i
< argc
; ++i
) foo();
116 #pragma omp teams distribute parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
117 for (i
= 0; i
< argc
; ++i
) foo();
119 #pragma omp teams distribute parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
120 for (i
= 0; i
< argc
; ++i
) foo();
122 #pragma omp teams distribute parallel for if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
123 for (i
= 0; i
< argc
; ++i
) foo();
125 #pragma omp teams distribute parallel for if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
126 for (i
= 0; i
< argc
; ++i
) foo();
128 #pragma omp teams distribute parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
129 for (i
= 0; i
< argc
; ++i
) foo();
131 #pragma omp teams distribute parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
132 for (i
= 0; i
< argc
; ++i
) foo();
134 #pragma omp teams distribute parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
135 for (i
= 0; i
< argc
; ++i
) foo();
137 #pragma omp teams distribute parallel for if(parallel : argc + z)
138 for (i
= 0; i
< argc
; ++i
) foo();
140 #pragma omp teams distribute parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp teams distribute parallel for'}}
141 for (i
= 0; i
< argc
; ++i
) foo();
143 #pragma omp teams distribute parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}}
144 for (i
= 0; i
< argc
; ++i
) foo();
146 #pragma omp teams distribute parallel for if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
147 for (i
= 0; i
< argc
; ++i
) foo();
149 #pragma omp teams distribute parallel for if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp teams distribute parallel for'}}
150 for (i
= 0; i
< argc
; ++i
) foo();
152 return tmain(argc
, argv
);