1 // RUN: %clang_cc1 -verify=expected,omp4 -fopenmp -fopenmp-version=45 %s -Wno-openmp-mapping -Wuninitialized
2 // RUN: %clang_cc1 -verify=expected,omp5 -fopenmp %s -Wno-openmp-mapping -Wuninitialized
4 // RUN: %clang_cc1 -verify=expected,omp4 -fopenmp-simd -fopenmp-version=45 %s -Wno-openmp-mapping -Wuninitialized
5 // RUN: %clang_cc1 -verify=expected,omp5 -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized
6 extern int omp_default_mem_alloc
;
10 bool foobool(int argc
) {
15 int fp
; // expected-note {{initialize the variable 'fp' to silence this warning}}
17 #pragma omp teams distribute parallel for simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
18 for (int i
= 0; i
< 10; ++i
)
22 struct S1
; // expected-note {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
29 S2(const S2
&s2
) : a(s2
.a
) {}
31 static const float S2sc
;
33 const float S2::S2sc
= 0;
38 S3
&operator=(const S3
&s3
);
41 S3() : a(0) {} // expected-note 2 {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
42 S3(S3
&s3
) : a(s3
.a
) {} // expected-note 2 {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}}
57 S5(const S5
&s5
):a(s5
.a
) { }
68 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
70 int main(int argc
, char **argv
) {
72 const int da
[5] = { 0 };
80 #pragma omp teams distribute parallel for simd firstprivate // expected-error {{expected '(' after 'firstprivate'}}
81 for (i
= 0; i
< argc
; ++i
) foo();
84 #pragma omp teams distribute parallel for simd firstprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
85 for (i
= 0; i
< argc
; ++i
) foo();
88 #pragma omp teams distribute parallel for simd firstprivate () // expected-error {{expected expression}}
89 for (i
= 0; i
< argc
; ++i
) foo();
92 #pragma omp teams distribute parallel for simd firstprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
93 for (i
= 0; i
< argc
; ++i
) foo();
96 #pragma omp teams distribute parallel for simd firstprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
97 for (i
= 0; i
< argc
; ++i
) foo();
100 #pragma omp teams distribute parallel for simd firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
101 for (i
= 0; i
< argc
; ++i
) foo();
104 #pragma omp teams distribute parallel for simd 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 '('}}
105 for (i
= 0; i
< argc
; ++i
) foo();
108 #pragma omp teams distribute parallel for simd firstprivate (S1) // expected-error {{'S1' does not refer to a value}}
109 for (i
= 0; i
< argc
; ++i
) foo();
112 #pragma omp teams distribute parallel for simd firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-error {{incomplete type 'S1' where a complete type is required}} expected-error {{no matching constructor for initialization of 'S3'}}
113 for (i
= 0; i
< argc
; ++i
) foo();
116 #pragma omp teams distribute parallel for simd firstprivate (argv[1]) // expected-error {{expected variable name}}
117 for (i
= 0; i
< argc
; ++i
) foo();
120 #pragma omp teams distribute parallel for simd firstprivate(ba, z)
121 for (i
= 0; i
< argc
; ++i
) foo();
124 #pragma omp teams distribute parallel for simd firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
125 for (i
= 0; i
< argc
; ++i
) foo();
128 #pragma omp teams distribute parallel for simd firstprivate(da)
129 for (i
= 0; i
< argc
; ++i
) foo();
132 #pragma omp teams distribute parallel for simd firstprivate(S2::S2s)
133 for (i
= 0; i
< argc
; ++i
) foo();
136 #pragma omp teams distribute parallel for simd firstprivate(S2::S2sc)
137 for (i
= 0; i
< argc
; ++i
) foo();
140 #pragma omp teams distribute parallel for simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
141 for (i
= 0; i
< argc
; ++i
) foo();
144 #pragma omp teams distribute parallel for simd private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} omp4-note 2 {{defined as private}} omp5-note {{defined as private}}
145 for (i
= 0; i
< argc
; ++i
) foo(); // omp4-error {{loop iteration variable in the associated loop of 'omp teams distribute parallel for simd' directive may not be private, predetermined as linear}}
148 #pragma omp teams distribute parallel for simd firstprivate(i)
149 for (j
= 0; j
< argc
; ++j
) foo();
152 #pragma omp teams distribute parallel for simd firstprivate(i) // expected-note {{defined as firstprivate}}
153 for (i
= 0; i
< argc
; ++i
) foo(); // expected-error {{loop iteration variable in the associated loop of 'omp teams distribute parallel for simd' directive may not be firstprivate, predetermined as linear}}
156 #pragma omp teams distribute parallel for simd firstprivate(j)
157 for (i
= 0; i
< argc
; ++i
) foo();
159 // expected-error@+2 {{lastprivate variable cannot be firstprivate}} expected-note@+2 {{defined as lastprivate}}
161 #pragma omp teams distribute parallel for simd lastprivate(argc), firstprivate(argc)
162 for (i
= 0; i
< argc
; ++i
) foo();