1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -Wuninitialized
8 bool foobool(int argc
) {
13 int cond
; // expected-note {{initialize the variable 'cond' to silence this warning}}
14 #pragma omp parallel for simd if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}}
15 for (int i
= 0; i
< 10; ++i
)
19 struct S1
; // expected-note {{declared here}}
21 template <class T
, class S
> // expected-note {{declared here}}
22 int tmain(T argc
, S
**argv
) {
24 #pragma omp parallel for simd if // expected-error {{expected '(' after 'if'}}
25 for (i
= 0; i
< argc
; ++i
) foo();
26 #pragma omp parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27 for (i
= 0; i
< argc
; ++i
) foo();
28 #pragma omp parallel for simd if () // expected-error {{expected expression}}
29 for (i
= 0; i
< argc
; ++i
) foo();
30 #pragma omp parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
31 for (i
= 0; i
< argc
; ++i
) foo();
32 #pragma omp parallel for simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
33 for (i
= 0; i
< argc
; ++i
) foo();
34 #pragma omp parallel for simd if (argc > 0 ? argv[1] : argv[2])
35 for (i
= 0; i
< argc
; ++i
) foo();
36 #pragma omp parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause}}
37 for (i
= 0; i
< argc
; ++i
) foo();
38 #pragma omp parallel for simd if (S) // expected-error {{'S' does not refer to a value}}
39 for (i
= 0; i
< argc
; ++i
) foo();
40 #pragma omp parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
41 for (i
= 0; i
< argc
; ++i
) foo();
42 #pragma omp parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
43 for (i
= 0; i
< argc
; ++i
) foo();
44 #pragma omp parallel for simd if(argc + z)
45 for (i
= 0; i
< argc
; ++i
) foo();
46 #pragma omp parallel for simd if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
47 for (i
= 0; i
< argc
; ++i
) foo();
48 #pragma omp parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
49 for (i
= 0; i
< argc
; ++i
) foo();
50 #pragma omp parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
51 for (i
= 0; i
< argc
; ++i
) foo();
52 #pragma omp parallel for simd if(parallel : argc)
53 for (i
= 0; i
< argc
; ++i
) foo();
54 #pragma omp parallel for simd if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel for simd'}}
55 for (i
= 0; i
< argc
; ++i
) foo();
56 #pragma omp parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}}
57 for (i
= 0; i
< argc
; ++i
) foo();
58 #pragma omp parallel for simd if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
59 for (i
= 0; i
< argc
; ++i
) foo();
64 int main(int argc
, char **argv
) {
66 #pragma omp parallel for simd if // expected-error {{expected '(' after 'if'}}
67 for (i
= 0; i
< argc
; ++i
) foo();
68 #pragma omp parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
69 for (i
= 0; i
< argc
; ++i
) foo();
70 #pragma omp parallel for simd if () // expected-error {{expected expression}}
71 for (i
= 0; i
< argc
; ++i
) foo();
72 #pragma omp parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
73 for (i
= 0; i
< argc
; ++i
) foo();
74 #pragma omp parallel for simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
75 for (i
= 0; i
< argc
; ++i
) foo();
76 #pragma omp parallel for simd if (argc > 0 ? argv[1] : argv[2])
77 for (i
= 0; i
< argc
; ++i
) foo();
78 #pragma omp parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause}}
79 for (i
= 0; i
< argc
; ++i
) foo();
80 #pragma omp parallel for simd if (S1) // expected-error {{'S1' does not refer to a value}}
81 for (i
= 0; i
< argc
; ++i
) foo();
82 #pragma omp parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
83 for (i
= 0; i
< argc
; ++i
) foo();
84 #pragma omp parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
85 for (i
= 0; i
< argc
; ++i
) foo();
86 #pragma omp parallel for simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
87 for (i
= 0; i
< argc
; ++i
) foo();
88 #pragma omp parallel for simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
89 for (i
= 0; i
< argc
; ++i
) foo();
90 #pragma omp parallel for simd if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
91 for (i
= 0; i
< argc
; ++i
) foo();
92 #pragma omp parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
93 for (i
= 0; i
< argc
; ++i
) foo();
94 #pragma omp parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
95 for (i
= 0; i
< argc
; ++i
) foo();
96 #pragma omp parallel for simd if(parallel : argc / z)
97 for (i
= 0; i
< argc
; ++i
) foo();
98 #pragma omp parallel for simd if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel for simd'}}
99 for (i
= 0; i
< argc
; ++i
) foo();
100 #pragma omp parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}}
101 for (i
= 0; i
< argc
; ++i
) foo();
102 #pragma omp parallel for simd if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
103 for (i
= 0; i
< argc
; ++i
) foo();
105 return tmain(argc
, argv
);