1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
5 extern int omp_default_mem_alloc
;
9 bool foobool(int argc
) {
14 int fp
; // expected-note {{initialize the variable 'fp' to silence this warning}}
15 #pragma omp parallel firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
16 for (int i
= 0; i
< 10; ++i
)
20 struct S1
; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
26 S2(const S2
&s2
):a(s2
.a
) { }
28 static const float S2sc
;
30 const float S2::S2sc
= 0;
37 S3(const S3
&s3
):a(s3
.a
) { }
45 S4(const S4
&s4
); // expected-note {{implicitly declared private here}}
52 S5(const S5
&s5
):a(s5
.a
) { } // expected-note {{implicitly declared private here}}
58 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
62 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
68 int main(int argc
, char **argv
) {
69 const int d
= 5; // expected-note {{variable 'd' declared const here}}
70 const int da
[5] = { 0 };
76 #pragma omp parallel firstprivate // expected-error {{expected '(' after 'firstprivate'}}
77 #pragma omp parallel firstprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
78 #pragma omp parallel firstprivate () // expected-error {{expected expression}}
79 #pragma omp parallel firstprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
80 #pragma omp parallel firstprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
81 #pragma omp parallel firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
82 #pragma omp parallel firstprivate (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 '('}}
83 #pragma omp parallel firstprivate (S1) // expected-error {{'S1' does not refer to a value}}
84 #pragma omp parallel firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}}
85 #pragma omp parallel firstprivate (z, d)
86 d
= 5; // expected-error {{cannot assign to variable 'd' with const-qualified type}}
87 #pragma omp parallel firstprivate (argv[1]) // expected-error {{expected variable name}}
88 #pragma omp parallel firstprivate(ba)
89 #pragma omp parallel firstprivate(ca)
90 #pragma omp parallel firstprivate(da)
91 #pragma omp parallel firstprivate(S2::S2s)
92 #pragma omp parallel firstprivate(S2::S2sc)
93 #pragma omp parallel firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
94 #pragma omp parallel firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
95 #pragma omp parallel private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}}
97 #pragma omp parallel shared(i)
98 #pragma omp parallel firstprivate(i)
99 #pragma omp parallel firstprivate(j)
100 #pragma omp parallel firstprivate(m)