1*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
2*73e5d7bdSFazlay Rabbi
3*73e5d7bdSFazlay Rabbi // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
4*73e5d7bdSFazlay Rabbi
5*73e5d7bdSFazlay Rabbi typedef void **omp_allocator_handle_t;
6*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_null_allocator;
7*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_default_mem_alloc;
8*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
9*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_const_mem_alloc;
10*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
11*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
12*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
13*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_pteam_mem_alloc;
14*73e5d7bdSFazlay Rabbi extern const omp_allocator_handle_t omp_thread_mem_alloc;
15*73e5d7bdSFazlay Rabbi
xxx(int argc)16*73e5d7bdSFazlay Rabbi void xxx(int argc) {
17*73e5d7bdSFazlay Rabbi int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}}
18*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}}
19*73e5d7bdSFazlay Rabbi for (i = 0; i < 10; ++i)
20*73e5d7bdSFazlay Rabbi ;
21*73e5d7bdSFazlay Rabbi }
22*73e5d7bdSFazlay Rabbi
23*73e5d7bdSFazlay Rabbi namespace X {
24*73e5d7bdSFazlay Rabbi int x;
25*73e5d7bdSFazlay Rabbi };
26*73e5d7bdSFazlay Rabbi
27*73e5d7bdSFazlay Rabbi struct B {
28*73e5d7bdSFazlay Rabbi static int ib; // expected-note {{'B::ib' declared here}}
bfooB29*73e5d7bdSFazlay Rabbi static int bfoo() { return 8; }
30*73e5d7bdSFazlay Rabbi };
31*73e5d7bdSFazlay Rabbi
bfoo()32*73e5d7bdSFazlay Rabbi int bfoo() { return 4; }
33*73e5d7bdSFazlay Rabbi
34*73e5d7bdSFazlay Rabbi int z;
35*73e5d7bdSFazlay Rabbi const int C1 = 1;
36*73e5d7bdSFazlay Rabbi const int C2 = 2;
test_linear_colons()37*73e5d7bdSFazlay Rabbi void test_linear_colons()
38*73e5d7bdSFazlay Rabbi {
39*73e5d7bdSFazlay Rabbi int B = 0;
40*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(B:bfoo())
41*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
42*73e5d7bdSFazlay Rabbi // expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'}}
43*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(B::ib:B:bfoo())
44*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
45*73e5d7bdSFazlay Rabbi // expected-error@+1 {{use of undeclared identifier 'ib'; did you mean 'B::ib'}}
46*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(B:ib)
47*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
48*73e5d7bdSFazlay Rabbi // expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'?}}
49*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(z:B:ib)
50*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
51*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(B:B::bfoo())
52*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
53*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(X::x : ::z)
54*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
55*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(B,::z, X::x)
56*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
57*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(::z)
58*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
59*73e5d7bdSFazlay Rabbi // expected-error@+1 {{expected variable name}}
60*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(B::bfoo())
61*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
62*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(B::ib,B:C1+C2)
63*73e5d7bdSFazlay Rabbi for (int i = 0; i < 10; ++i) ;
64*73e5d7bdSFazlay Rabbi }
65*73e5d7bdSFazlay Rabbi
test_template(T * arr,N num)66*73e5d7bdSFazlay Rabbi template<int L, class T, class N> T test_template(T* arr, N num) {
67*73e5d7bdSFazlay Rabbi N i;
68*73e5d7bdSFazlay Rabbi T sum = (T)0;
69*73e5d7bdSFazlay Rabbi T ind2 = - num * L; // expected-note {{'ind2' defined here}}
70*73e5d7bdSFazlay Rabbi // expected-error@+1 {{argument of a linear clause should be of integral or pointer type}}
71*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(ind2:L)
72*73e5d7bdSFazlay Rabbi for (i = 0; i < num; ++i) {
73*73e5d7bdSFazlay Rabbi T cur = arr[(int)ind2];
74*73e5d7bdSFazlay Rabbi ind2 += L;
75*73e5d7bdSFazlay Rabbi sum += cur;
76*73e5d7bdSFazlay Rabbi }
77*73e5d7bdSFazlay Rabbi return T();
78*73e5d7bdSFazlay Rabbi }
79*73e5d7bdSFazlay Rabbi
test_warn()80*73e5d7bdSFazlay Rabbi template<int LEN> int test_warn() {
81*73e5d7bdSFazlay Rabbi int ind2 = 0;
82*73e5d7bdSFazlay Rabbi // expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
83*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(ind2:LEN)
84*73e5d7bdSFazlay Rabbi for (int i = 0; i < 100; i++) {
85*73e5d7bdSFazlay Rabbi ind2 += LEN;
86*73e5d7bdSFazlay Rabbi }
87*73e5d7bdSFazlay Rabbi return ind2;
88*73e5d7bdSFazlay Rabbi }
89*73e5d7bdSFazlay Rabbi
90*73e5d7bdSFazlay Rabbi struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
91*73e5d7bdSFazlay Rabbi extern S1 a;
92*73e5d7bdSFazlay Rabbi class S2 {
93*73e5d7bdSFazlay Rabbi mutable int a;
94*73e5d7bdSFazlay Rabbi public:
S2()95*73e5d7bdSFazlay Rabbi S2():a(0) { }
96*73e5d7bdSFazlay Rabbi };
97*73e5d7bdSFazlay Rabbi const S2 b; // expected-note 2 {{'b' defined here}}
98*73e5d7bdSFazlay Rabbi const S2 ba[5];
99*73e5d7bdSFazlay Rabbi class S3 {
100*73e5d7bdSFazlay Rabbi int a;
101*73e5d7bdSFazlay Rabbi public:
S3()102*73e5d7bdSFazlay Rabbi S3():a(0) { }
103*73e5d7bdSFazlay Rabbi };
104*73e5d7bdSFazlay Rabbi const S3 ca[5];
105*73e5d7bdSFazlay Rabbi class S4 {
106*73e5d7bdSFazlay Rabbi int a;
107*73e5d7bdSFazlay Rabbi S4();
108*73e5d7bdSFazlay Rabbi public:
S4(int v)109*73e5d7bdSFazlay Rabbi S4(int v):a(v) { }
110*73e5d7bdSFazlay Rabbi };
111*73e5d7bdSFazlay Rabbi class S5 {
112*73e5d7bdSFazlay Rabbi int a;
S5()113*73e5d7bdSFazlay Rabbi S5():a(0) {}
114*73e5d7bdSFazlay Rabbi public:
S5(int v)115*73e5d7bdSFazlay Rabbi S5(int v):a(v) { }
116*73e5d7bdSFazlay Rabbi };
117*73e5d7bdSFazlay Rabbi
118*73e5d7bdSFazlay Rabbi S3 h;
119*73e5d7bdSFazlay Rabbi #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
120*73e5d7bdSFazlay Rabbi
foomain(I argc,C ** argv)121*73e5d7bdSFazlay Rabbi template<class I, class C> int foomain(I argc, C **argv) {
122*73e5d7bdSFazlay Rabbi I e(4);
123*73e5d7bdSFazlay Rabbi I g(5);
124*73e5d7bdSFazlay Rabbi int i, z;
125*73e5d7bdSFazlay Rabbi int &j = i;
126*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear // expected-error {{expected '(' after 'linear'}}
127*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
128*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
129*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
130*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (val // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
131*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
132*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (uval( // expected-error {{expected expression}} expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
133*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
134*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (ref() // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
135*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
136*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (foo() // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
137*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
138*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear () // expected-error {{expected expression}}
139*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
140*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
141*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
142*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (val argc // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
143*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
144*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (val(argc, // expected-error {{expected expression}} expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
145*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
146*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
147*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
148*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (argc : 5) 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 '('}}
149*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
150*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (S1) // expected-error {{'S1' does not refer to a value}}
151*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
152*73e5d7bdSFazlay Rabbi // expected-error@+2 {{linear variable with incomplete type 'S1'}}
153*73e5d7bdSFazlay Rabbi // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S2'}}
154*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (val(a, b):B::ib)
155*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
156*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (argv[1]) // expected-error {{expected variable name}}
157*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
158*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(ref(e, g)) // expected-error 2 {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'ref'}}
159*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
160*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(h, z) // expected-error {{threadprivate or thread local variable cannot be linear}}
161*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
162*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(uval(i)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}}
163*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
164*73e5d7bdSFazlay Rabbi #pragma omp parallel
165*73e5d7bdSFazlay Rabbi {
166*73e5d7bdSFazlay Rabbi int v = 0;
167*73e5d7bdSFazlay Rabbi int i;
168*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd allocate(omp_thread_mem_alloc: v) linear(v:i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'master taskloop simd' directive}}
169*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) { i = k; v += i; }
170*73e5d7bdSFazlay Rabbi }
171*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(ref(j))
172*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
173*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(uval(j))
174*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
175*73e5d7bdSFazlay Rabbi int v = 0;
176*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(v:j)
177*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) { ++k; v += j; }
178*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(i)
179*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
180*73e5d7bdSFazlay Rabbi return 0;
181*73e5d7bdSFazlay Rabbi }
182*73e5d7bdSFazlay Rabbi
183*73e5d7bdSFazlay Rabbi namespace A {
184*73e5d7bdSFazlay Rabbi double x;
185*73e5d7bdSFazlay Rabbi #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
186*73e5d7bdSFazlay Rabbi }
187*73e5d7bdSFazlay Rabbi namespace C {
188*73e5d7bdSFazlay Rabbi using A::x;
189*73e5d7bdSFazlay Rabbi }
190*73e5d7bdSFazlay Rabbi
linear_modifiers(int argc)191*73e5d7bdSFazlay Rabbi void linear_modifiers(int argc) {
192*73e5d7bdSFazlay Rabbi int &f = argc;
193*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(f)
194*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
195*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(val(f))
196*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
197*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(uval(f))
198*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
199*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(ref(f))
200*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
201*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(foo(f)) // expected-error {{expected one of 'ref', val' or 'uval' modifiers}}
202*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
203*73e5d7bdSFazlay Rabbi }
204*73e5d7bdSFazlay Rabbi
205*73e5d7bdSFazlay Rabbi int f;
main(int argc,char ** argv)206*73e5d7bdSFazlay Rabbi int main(int argc, char **argv) {
207*73e5d7bdSFazlay Rabbi double darr[100];
208*73e5d7bdSFazlay Rabbi // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
209*73e5d7bdSFazlay Rabbi test_template<-4>(darr, 4);
210*73e5d7bdSFazlay Rabbi // expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}}
211*73e5d7bdSFazlay Rabbi test_warn<0>();
212*73e5d7bdSFazlay Rabbi
213*73e5d7bdSFazlay Rabbi S4 e(4); // expected-note {{'e' defined here}}
214*73e5d7bdSFazlay Rabbi S5 g(5); // expected-note {{'g' defined here}}
215*73e5d7bdSFazlay Rabbi int i, z;
216*73e5d7bdSFazlay Rabbi int &j = i;
217*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(f) linear(f) // expected-error {{linear variable cannot be linear}} expected-note {{defined as linear}}
218*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
219*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear // expected-error {{expected '(' after 'linear'}}
220*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
221*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
222*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
223*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear () // expected-error {{expected expression}}
224*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
225*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (val // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
226*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
227*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (ref()) // expected-error {{expected expression}}
228*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
229*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (foo()) // expected-error {{expected expression}}
230*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
231*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
232*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
233*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
234*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
235*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
236*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
237*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (argc, z)
238*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
239*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (S1) // expected-error {{'S1' does not refer to a value}}
240*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
241*73e5d7bdSFazlay Rabbi // expected-error@+2 {{linear variable with incomplete type 'S1'}}
242*73e5d7bdSFazlay Rabbi // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S2'}}
243*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(a, b)
244*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
245*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear (argv[1]) // expected-error {{expected variable name}}
246*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
247*73e5d7bdSFazlay Rabbi // expected-error@+2 {{argument of a linear clause should be of integral or pointer type, not 'S4'}}
248*73e5d7bdSFazlay Rabbi // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}}
249*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(val(e, g))
250*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
251*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}}
252*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
253*73e5d7bdSFazlay Rabbi #pragma omp parallel
254*73e5d7bdSFazlay Rabbi {
255*73e5d7bdSFazlay Rabbi int i;
256*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(val(i))
257*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
258*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(uval(i) : 4) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}}
259*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) { ++k; i += 4; }
260*73e5d7bdSFazlay Rabbi }
261*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(ref(j))
262*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
263*73e5d7bdSFazlay Rabbi #pragma omp master taskloop simd linear(i)
264*73e5d7bdSFazlay Rabbi for (int k = 0; k < argc; ++k) ++k;
265*73e5d7bdSFazlay Rabbi
266*73e5d7bdSFazlay Rabbi foomain<int,char>(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}
267*73e5d7bdSFazlay Rabbi return 0;
268*73e5d7bdSFazlay Rabbi }
269*73e5d7bdSFazlay Rabbi
270