1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
5 typedef void **omp_allocator_handle_t
;
6 extern const omp_allocator_handle_t omp_null_allocator
;
7 extern const omp_allocator_handle_t omp_default_mem_alloc
;
8 extern const omp_allocator_handle_t omp_large_cap_mem_alloc
;
9 extern const omp_allocator_handle_t omp_const_mem_alloc
;
10 extern const omp_allocator_handle_t omp_high_bw_mem_alloc
;
11 extern const omp_allocator_handle_t omp_low_lat_mem_alloc
;
12 extern const omp_allocator_handle_t omp_cgroup_mem_alloc
;
13 extern const omp_allocator_handle_t omp_pteam_mem_alloc
;
14 extern const omp_allocator_handle_t omp_thread_mem_alloc
;
19 bool foobool(int argc
) {
23 struct S1
; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
42 S4(); // expected-note {{implicitly declared private here}}
46 #pragma omp target simd private(a) private(this->a)
47 for (int k
= 0; k
< v
; ++k
)
53 S5() : a(0) {} // expected-note {{implicitly declared private here}}
57 S5
&operator=(S5
&s
) {
58 #pragma omp target simd private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
59 for (int k
= 0; k
< s
.a
; ++k
) // expected-warning {{type 'S5' is not trivially copyable and not guaranteed to be mapped correctly}}
72 #pragma omp target simd private(a) private(this->a) allocate(omp_thread_mem_alloc: a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}} expected-error {{allocator must be specified in the 'uses_allocators' clause}}
73 for (int k
= 0; k
< v
; ++k
)
76 S6
&operator=(S6
&s
) {
77 #pragma omp target simd private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
78 for (int k
= 0; k
< s
.a
; ++k
)
91 #pragma omp target simd private(a) private(this->a) private(T::a)
92 for (int k
= 0; k
< a
.a
; ++k
)
95 S7
&operator=(S7
&s
) {
96 #pragma omp target simd private(a) private(this->a) private(s.a) private(s.T::a) // expected-error 2 {{expected variable name or data member of current class}}
97 for (int k
= 0; k
< s
.a
.a
; ++k
)
104 #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
106 template <class I
, class C
>
107 int foomain(I argc
, C
**argv
) {
112 #pragma omp target simd private // expected-error {{expected '(' after 'private'}}
113 for (int k
= 0; k
< argc
; ++k
)
115 #pragma omp target simd private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
116 for (int k
= 0; k
< argc
; ++k
)
118 #pragma omp target simd private() // expected-error {{expected expression}}
119 for (int k
= 0; k
< argc
; ++k
)
121 #pragma omp target simd private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
122 for (int k
= 0; k
< argc
; ++k
)
124 #pragma omp target simd private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
125 for (int k
= 0; k
< argc
; ++k
)
127 #pragma omp target simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
128 for (int k
= 0; k
< argc
; ++k
)
130 #pragma omp target simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
131 for (int k
= 0; k
< argc
; ++k
)
133 #pragma omp target simd private(S1) // expected-error {{'S1' does not refer to a value}}
134 for (int k
= 0; k
< argc
; ++k
)
136 #pragma omp target simd private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
137 for (int k
= 0; k
< argc
; ++k
)
139 #pragma omp target simd private(argv[1]) // expected-error {{expected variable name}}
140 for (int k
= 0; k
< argc
; ++k
)
142 #pragma omp target simd private(e, g, z)
143 for (int k
= 0; k
< argc
; ++k
)
145 #pragma omp target simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
146 for (int k
= 0; k
< argc
; ++k
)
152 #pragma omp target simd private(i)
153 for (int k
= 0; k
< argc
; ++k
) {
158 #pragma omp parallel shared(i)
159 #pragma omp parallel private(i)
160 #pragma omp target simd private(j)
161 for (int k
= 0; k
< argc
; ++k
)
163 #pragma omp target simd private(i)
164 for (int k
= 0; k
< argc
; ++k
)
171 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
177 int main(int argc
, char **argv
) {
180 S6
<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}}
181 S7
<S6
<float> > s7(0.0) , s7_0(1.0);
184 #pragma omp target simd private // expected-error {{expected '(' after 'private'}}
185 for (int k
= 0; k
< argc
; ++k
)
187 #pragma omp target simd private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
188 for (int k
= 0; k
< argc
; ++k
)
190 #pragma omp target simd private() // expected-error {{expected expression}}
191 for (int k
= 0; k
< argc
; ++k
)
193 #pragma omp target simd private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
194 for (int k
= 0; k
< argc
; ++k
)
196 #pragma omp target simd private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
197 for (int k
= 0; k
< argc
; ++k
)
199 #pragma omp target simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
200 for (int k
= 0; k
< argc
; ++k
)
202 #pragma omp target simd private(argc, z)
203 for (int k
= 0; k
< argc
; ++k
)
205 #pragma omp target simd private(S1) // expected-error {{'S1' does not refer to a value}}
206 for (int k
= 0; k
< argc
; ++k
)
208 #pragma omp target simd private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
209 for (int k
= 0; k
< argc
; ++k
)
211 #pragma omp target simd private(argv[1]) // expected-error {{expected variable name}}
212 for (int k
= 0; k
< argc
; ++k
)
214 #pragma omp target simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
215 for (int k
= 0; k
< argc
; ++k
)
217 #pragma omp target simd private(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
218 for (int k
= 0; k
< argc
; ++k
)
223 #pragma omp target simd private(i)
224 for (int k
= 0; k
< argc
; ++k
)
227 #pragma omp parallel shared(i)
228 #pragma omp parallel private(i)
229 #pragma omp target simd private(j)
230 for (int k
= 0; k
< argc
; ++k
)
232 #pragma omp target simd private(i)
233 for (int k
= 0; k
< argc
; ++k
)
236 #pragma omp target simd private(m)
237 for (int k
= 0; k
< argc
; ++k
)
240 s6
= s6_0
; // expected-note {{in instantiation of member function 'S6<float>::operator=' requested here}}
241 s7
= s7_0
; // expected-note {{in instantiation of member function 'S7<S6<float>>::operator=' requested here}}
242 return foomain(argc
, argv
); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}