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}}
17 #pragma omp target teams distribute parallel for 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
) {
27 #pragma omp target teams distribute parallel for if // expected-error {{expected '(' after 'if'}}
28 for (i
= 0; i
< argc
; ++i
) foo();
29 #pragma omp target teams distribute parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
30 for (i
= 0; i
< argc
; ++i
) foo();
31 #pragma omp target teams distribute parallel for if () // expected-error {{expected expression}}
32 for (i
= 0; i
< argc
; ++i
) foo();
33 #pragma omp target teams distribute parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
34 for (i
= 0; i
< argc
; ++i
) foo();
35 #pragma omp target teams distribute parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
36 for (i
= 0; i
< argc
; ++i
) foo();
37 #pragma omp target teams distribute parallel for if (argc > 0 ? argv[1] : argv[2])
38 for (i
= 0; i
< argc
; ++i
) foo();
39 #pragma omp target teams distribute parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'if' clause}}
40 for (i
= 0; i
< argc
; ++i
) foo();
41 #pragma omp target teams distribute parallel for if (S) // expected-error {{'S' does not refer to a value}}
42 for (i
= 0; i
< argc
; ++i
) foo();
43 #pragma omp target teams distribute parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
44 for (i
= 0; i
< argc
; ++i
) foo();
45 #pragma omp target teams distribute parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
46 for (i
= 0; i
< argc
; ++i
) foo();
47 #pragma omp target teams distribute parallel for if(argc -z)
48 for (i
= 0; i
< argc
; ++i
) foo();
49 #pragma omp target teams distribute parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
50 for (i
= 0; i
< argc
; ++i
) foo();
51 #pragma omp target teams distribute parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
52 for (i
= 0; i
< argc
; ++i
) foo();
53 #pragma omp target teams distribute parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
54 for (i
= 0; i
< argc
; ++i
) foo();
55 #pragma omp target teams distribute parallel for if(parallel : argc)
56 for (i
= 0; i
< argc
; ++i
) foo();
57 #pragma omp target teams distribute parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target teams distribute parallel for'}}
58 for (i
= 0; i
< argc
; ++i
) foo();
59 #pragma omp target teams distribute parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}}
60 for (i
= 0; i
< argc
; ++i
) foo();
61 #pragma omp target teams distribute parallel for if(target : argc) if (target:argc) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'if' clause with 'target' name modifier}}
62 for (i
= 0; i
< argc
; ++i
) foo();
63 #pragma omp target teams distribute parallel for if(parallel : argc) if (argc) // expected-error {{expected 'target' directive name modifier}} expected-note {{previous clause with directive name modifier specified here}}
64 for (i
= 0; i
< argc
; ++i
) foo();
65 #pragma omp target teams distribute parallel for if(target: argc) if (argc) // expected-error {{expected 'parallel' directive name modifier}} expected-note {{previous clause with directive name modifier specified here}}
66 for (i
= 0; i
< argc
; ++i
) foo();
67 #pragma omp target teams distribute parallel for if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute parallel for'}}
68 for (i
= 0; i
< argc
; ++i
) foo();
73 int main(int argc
, char **argv
) {
75 #pragma omp target teams distribute parallel for if // expected-error {{expected '(' after 'if'}}
76 for (i
= 0; i
< argc
; ++i
) foo();
77 #pragma omp target teams distribute parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
78 for (i
= 0; i
< argc
; ++i
) foo();
79 #pragma omp target teams distribute parallel for if () // expected-error {{expected expression}}
80 for (i
= 0; i
< argc
; ++i
) foo();
81 #pragma omp target teams distribute parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
82 for (i
= 0; i
< argc
; ++i
) foo();
83 #pragma omp target teams distribute parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute parallel for' are ignored}}
84 for (i
= 0; i
< argc
; ++i
) foo();
85 #pragma omp target teams distribute parallel for if (argc > 0 ? argv[1] : argv[2])
86 for (i
= 0; i
< argc
; ++i
) foo();
87 #pragma omp target teams distribute parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'if' clause}}
88 for (i
= 0; i
< argc
; ++i
) foo();
89 #pragma omp target teams distribute parallel for if (S1) // expected-error {{'S1' does not refer to a value}}
90 for (i
= 0; i
< argc
; ++i
) foo();
91 #pragma omp target teams distribute parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
92 for (i
= 0; i
< argc
; ++i
) foo();
93 #pragma omp target teams distribute parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
94 for (i
= 0; i
< argc
; ++i
) foo();
95 #pragma omp target teams distribute parallel for if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
96 for (i
= 0; i
< argc
; ++i
) foo();
97 #pragma omp target teams distribute parallel for if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
98 for (i
= 0; i
< argc
; ++i
) foo();
99 #pragma omp target teams distribute parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
100 for (i
= 0; i
< argc
; ++i
) foo();
101 #pragma omp target teams distribute parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
102 for (i
= 0; i
< argc
; ++i
) foo();
103 #pragma omp target teams distribute parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
104 for (i
= 0; i
< argc
; ++i
) foo();
105 #pragma omp target teams distribute parallel for if(parallel : argc / z)
106 for (i
= 0; i
< argc
; ++i
) foo();
107 #pragma omp target teams distribute parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target teams distribute parallel for'}}
108 for (i
= 0; i
< argc
; ++i
) foo();
109 #pragma omp target teams distribute parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}}
110 for (i
= 0; i
< argc
; ++i
) foo();
111 #pragma omp target teams distribute parallel for if(target: argc) if (target:argc) // expected-error {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'if' clause with 'target' name modifier}}
112 for (i
= 0; i
< argc
; ++i
) foo();
113 #pragma omp target teams distribute parallel for if(parallel : argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{expected 'target' directive name modifier}}
114 for (i
= 0; i
< argc
; ++i
) foo();
115 #pragma omp target teams distribute parallel for if(target: argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{expected 'parallel' directive name modifier}}
116 for (i
= 0; i
< argc
; ++i
) foo();
117 #pragma omp target teams distribute parallel for if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute parallel for'}}
118 for (i
= 0; i
< argc
; ++i
) foo();
119 #pragma omp target teams distribute parallel for default(none) if(argc+argv[0][0]) // expected-error {{variable 'argv' must have explicitly specified data sharing attributes}} expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} expected-note 2 {{explicit data sharing attribute requested here}}
120 for (i
= 0; i
< argc
; ++i
) foo();
122 return tmain(argc
, argv
);