1 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp -ferror-limit 100 %s -Wuninitialized
4 // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp51 -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
10 bool foobool(int argc
) {
15 int cond
; // expected-note {{initialize the variable 'cond' to silence this warning}}
17 #pragma omp teams distribute parallel for simd if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}}
18 for (int i
= 0; i
< 10; ++i
)
22 struct S1
; // expected-note {{declared here}}
24 template <class T
, class S
> // expected-note {{declared here}}
25 int tmain(T argc
, S
**argv
) {
28 #pragma omp teams distribute parallel for simd if // expected-error {{expected '(' after 'if'}}
29 for (i
= 0; i
< argc
; ++i
) foo();
31 #pragma omp teams distribute parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
32 for (i
= 0; i
< argc
; ++i
) foo();
34 #pragma omp teams distribute parallel for simd if () // expected-error {{expected expression}}
35 for (i
= 0; i
< argc
; ++i
) foo();
37 #pragma omp teams distribute parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
38 for (i
= 0; i
< argc
; ++i
) foo();
40 #pragma omp teams distribute parallel for simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
41 for (i
= 0; i
< argc
; ++i
) foo();
43 #pragma omp teams distribute parallel for simd if (argc > 0 ? argv[1] : argv[2])
44 for (i
= 0; i
< argc
; ++i
) foo();
46 #pragma omp teams distribute parallel for simd if (foobool(argc)*z), if (true) // expected-error {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'if' clause}}
47 for (i
= 0; i
< argc
; ++i
) foo();
49 #pragma omp teams distribute parallel for simd if (S) // expected-error {{'S' does not refer to a value}}
50 for (i
= 0; i
< argc
; ++i
) foo();
52 #pragma omp teams distribute parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
53 for (i
= 0; i
< argc
; ++i
) foo();
55 #pragma omp teams distribute parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
56 for (i
= 0; i
< argc
; ++i
) foo();
58 #pragma omp teams distribute parallel for simd if(argc)
59 for (i
= 0; i
< argc
; ++i
) foo();
61 #pragma omp teams distribute parallel for simd if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
62 for (i
= 0; i
< argc
; ++i
) foo();
64 #pragma omp teams distribute parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
65 for (i
= 0; i
< argc
; ++i
) foo();
67 #pragma omp teams distribute parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
68 for (i
= 0; i
< argc
; ++i
) foo();
70 #pragma omp teams distribute parallel for simd if(parallel : argc)
71 for (i
= 0; i
< argc
; ++i
) foo();
73 #pragma omp teams distribute parallel for simd if(parallel : argc) if (simd:argc) // omp45-error {{directive name modifier 'simd' is not allowed for '#pragma omp teams distribute parallel for simd'}}
74 for (i
= 0; i
< argc
; ++i
) foo();
76 #pragma omp teams distribute parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}}
77 for (i
= 0; i
< argc
; ++i
) foo();
79 #pragma omp teams distribute parallel for simd if(parallel : argc) if (argc) // omp45-error {{no more 'if' clause is allowed}} omp51-error {{expected 'simd' directive name modifier}} expected-note {{previous clause with directive name modifier specified here}}
80 for (i
= 0; i
< argc
; ++i
) foo();
82 #pragma omp teams distribute parallel for simd if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp teams distribute parallel for simd'}}
83 for (i
= 0; i
< argc
; ++i
) foo();
88 int main(int argc
, char **argv
) {
91 #pragma omp teams distribute parallel for simd if // expected-error {{expected '(' after 'if'}}
92 for (i
= 0; i
< argc
; ++i
) foo();
94 #pragma omp teams distribute parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
95 for (i
= 0; i
< argc
; ++i
) foo();
97 #pragma omp teams distribute parallel for simd if () // expected-error {{expected expression}}
98 for (i
= 0; i
< argc
; ++i
) foo();
100 #pragma omp teams distribute parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
101 for (i
= 0; i
< argc
; ++i
) foo();
103 #pragma omp teams distribute parallel for simd if (argc/z)) // expected-warning {{extra tokens at the end of '#pragma omp teams distribute parallel for simd' are ignored}}
104 for (i
= 0; i
< argc
; ++i
) foo();
106 #pragma omp teams distribute parallel for simd if (argc > 0 ? argv[1] : argv[2])
107 for (i
= 0; i
< argc
; ++i
) foo();
109 #pragma omp teams distribute parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'if' clause}}
110 for (i
= 0; i
< argc
; ++i
) foo();
112 #pragma omp teams distribute parallel for simd if (S1) // expected-error {{'S1' does not refer to a value}}
113 for (i
= 0; i
< argc
; ++i
) foo();
115 #pragma omp teams distribute parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
116 for (i
= 0; i
< argc
; ++i
) foo();
118 #pragma omp teams distribute parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
119 for (i
= 0; i
< argc
; ++i
) foo();
121 #pragma omp teams distribute parallel for simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
122 for (i
= 0; i
< argc
; ++i
) foo();
124 #pragma omp teams distribute parallel for simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
125 for (i
= 0; i
< argc
; ++i
) foo();
127 #pragma omp teams distribute parallel for simd if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
128 for (i
= 0; i
< argc
; ++i
) foo();
130 #pragma omp teams distribute parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
131 for (i
= 0; i
< argc
; ++i
) foo();
133 #pragma omp teams distribute parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
134 for (i
= 0; i
< argc
; ++i
) foo();
136 #pragma omp teams distribute parallel for simd if(parallel : argc)
137 for (i
= 0; i
< argc
; ++i
) foo();
139 #pragma omp teams distribute parallel for simd if(parallel : argc) if (simd:argc) // omp45-error {{directive name modifier 'simd' is not allowed for '#pragma omp teams distribute parallel for simd'}}
140 for (i
= 0; i
< argc
; ++i
) foo();
142 #pragma omp teams distribute parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}}
143 for (i
= 0; i
< argc
; ++i
) foo();
145 #pragma omp teams distribute parallel for simd if(parallel : argc) if (argc) //omp45-error {{no more 'if' clause is allowed}} omp51-error {{expected 'simd' directive name modifier}} expected-note {{previous clause with directive name modifier specified here}}
146 for (i
= 0; i
< argc
; ++i
) foo();
148 #pragma omp teams distribute parallel for simd if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp teams distribute parallel for simd'}}
149 for (i
= 0; i
< argc
; ++i
) foo();
151 return tmain(argc
, argv
);