1 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std
=CL2.0
2 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std
=CL2.0
3 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std
=CL2.0
4 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std
=clc
++1.0
5 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std
=clc
++1.0
6 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std
=clc
++1.0
7 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std
=CL3.0 -cl-ext
=+__opencl_c_generic_address_space
8 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std
=CL3.0 -cl-ext
=+__opencl_c_generic_address_space
9 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std
=CL3.0 -cl-ext
=+__opencl_c_generic_address_space
10 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std
=clc
++2021 -cl-ext
=+__opencl_c_generic_address_space
11 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std
=clc
++2021 -cl-ext
=+__opencl_c_generic_address_space
12 // RUN
: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std
=clc
++2021 -cl-ext
=+__opencl_c_generic_address_space
14 /* OpenCLC v2.0 adds a set of restrictions for conversions between pointers to
15 * different address spaces
, mainly described in Sections
6.5.5 and
6.5.6.
17 * It adds notion of overlapping address spaces. The main differention is that
18 * an unnamed address space is added
, called
'__generic
'. Pointers to the
19 * generic address space can be interchangabley used with pointers to any
20 * other address space except for __constant address space
(Section 6.5.5).
22 * Based on this there are
3 sets of tests
: __generic
, named
(__global in this
23 * case
), and __constant
, that should cover all program paths for CL address
24 * space conversions used in initialisations
, assignments
, casts
, comparisons
25 * and arithmetic operations.
27 * OpenCLC v3.0 supports generic address if __opencl_c_generic_address_space feature is supported
32 #define AS_COMP __local
33 #define AS_INCOMP __constant
38 #define AS_COMP __global
39 #define AS_INCOMP __local
44 #define AS_COMP __constant
45 #define AS_INCOMP __global
48 void f_glob
(__global int
*arg_glob
) {}
50 #if
!__OPENCL_CPP_VERSION__
51 // expected-note
@-
3{{passing argument to parameter
'arg_glob
' here
}}
53 // expected-note-re
@-
5{{candidate function not viable
: cannot pass pointer to address space
'__
{{generic|constant
}}' as a pointer to address space
'__global
' in
1st argument
}}
57 void f_loc
(__local int
*arg_loc
) {}
58 #if
!__OPENCL_CPP_VERSION__
59 // expected-note
@-
2{{passing argument to parameter
'arg_loc
' here
}}
61 // expected-note-re
@-
4{{candidate function not viable
: cannot pass pointer to address space
'__
{{global|generic|constant
}}' as a pointer to address space
'__local
' in
1st argument
}}
64 void f_const
(__constant int
*arg_const
) {}
66 #if
!__OPENCL_CPP_VERSION__
67 // expected-note
@-
3{{passing argument to parameter
'arg_const
' here
}}
69 // expected-note-re
@-
5{{candidate function not viable
: cannot pass pointer to address space
'__
{{global|generic
}}' as a pointer to address space
'__constant
' in
1st argument
}}
73 void f_priv
(__private int
*arg_priv
) {}
74 #if
!__OPENCL_CPP_VERSION__
75 // expected-note
@-
2{{passing argument to parameter
'arg_priv
' here
}}
77 // expected-note-re
@-
4{{candidate function not viable
: cannot pass pointer to address space
'__
{{global|generic|constant
}}' as a pointer to address space
'__private
' in
1st argument
}}
80 void f_gen
(__generic int
*arg_gen
) {}
82 #if
!__OPENCL_CPP_VERSION__
83 // expected-note
@-
3{{passing argument to parameter
'arg_gen
' here
}}
85 // expected-note
@-
5{{candidate function not viable
: cannot pass pointer to address space
'__constant
' as a pointer to address space
'__generic
' in
1st argument
}}
89 void test_conversion
(__global int
*arg_glob
, __local int
*arg_loc
,
90 __constant int
*arg_const
, __private int
*arg_priv
,
91 __generic int
*arg_gen
) {
93 AS int
*var_init1
= arg_glob
;
95 #if
!__OPENCL_CPP_VERSION__
96 // expected-error
@-
3{{initializing
'__constant int
*__private
' with an expression of type
'__global int
*__private
' changes address space of pointer
}}
98 // expected-error
@-
5{{cannot initialize a variable of type
'__constant int
*__private
' with an lvalue of type
'__global int
*__private
'}}
102 AS int
*var_init2
= arg_loc
;
104 #if
!__OPENCL_CPP_VERSION__
105 // expected-error-re
@-
3{{initializing
'__
{{global|constant
}} int
*__private
' with an expression of type
'__local int
*__private
' changes address space of pointer
}}
107 // expected-error-re
@-
5{{cannot initialize a variable of type
'__
{{global|constant
}} int
*__private
' with an lvalue of type
'__local int
*__private
'}}
111 AS int
*var_init3
= arg_const
;
113 #if
!__OPENCL_CPP_VERSION__
114 // expected-error-re
@-
3{{initializing
'__
{{global|generic
}} int
*__private
' with an expression of type
'__constant int
*__private
' changes address space of pointer
}}
116 // expected-error-re
@-
5{{cannot initialize a variable of type
'__
{{global|generic
}} int
*__private
' with an lvalue of type
'__constant int
*__private
'}}
120 AS int
*var_init4
= arg_priv
;
122 #if
!__OPENCL_CPP_VERSION__
123 // expected-error-re
@-
3{{initializing
'__
{{global|constant
}} int
*__private
' with an expression of type
'__private int
*__private
' changes address space of pointer
}}
125 // expected-error-re
@-
5{{cannot initialize a variable of type
'__
{{global|constant
}} int
*__private
' with an lvalue of type
'__private int
*__private
'}}
129 AS int
*var_init5
= arg_gen
;
131 #if
!__OPENCL_CPP_VERSION__
132 // expected-error-re
@-
3{{initializing
'__
{{global|constant
}} int
*__private
' with an expression of type
'__generic int
*__private
' changes address space of pointer
}}
134 // expected-error-re
@-
5{{cannot initialize a variable of type
'__
{{global|constant
}} int
*__private
' with an lvalue of type
'__generic int
*__private
'}}
138 AS int
*var_cast1
= (AS int
*)arg_glob
;
140 #if
!__OPENCL_CPP_VERSION__
141 // expected-error
@-
3{{casting
'__global int
*' to type
'__constant int
*' changes address space of pointer
}}
143 // expected-error
@-
5{{C-style cast from
'__global int
*' to
'__constant int
*' converts between mismatching address spaces
}}
147 AS int
*var_cast2
= (AS int
*)arg_loc
;
149 #if
!__OPENCL_CPP_VERSION__
150 // expected-error-re
@-
3{{casting
'__local int
*' to type
'__
{{global|constant
}} int
*' changes address space of pointer
}}
152 // expected-error-re
@-
5{{C-style cast from
'__local int
*' to
'__
{{global|constant
}} int
*' converts between mismatching address spaces
}}
156 AS int
*var_cast3
= (AS int
*)arg_const
;
158 #if
!__OPENCL_CPP_VERSION__
159 // expected-error-re
@-
3{{casting
'__constant int
*' to type
'__
{{global|generic
}} int
*' changes address space of pointer
}}
161 // expected-error-re
@-
5{{C-style cast from
'__constant int
*' to
'__
{{global|generic
}} int
*' converts between mismatching address spaces
}}
165 AS int
*var_cast4
= (AS int
*)arg_priv
;
167 #if
!__OPENCL_CPP_VERSION__
168 // expected-error-re
@-
3{{casting
'__private int
*' to type
'__
{{global|constant
}} int
*' changes address space of pointer
}}
170 // expected-error-re
@-
5{{C-style cast from
'__private int
*' to
'__
{{global|constant
}} int
*' converts between mismatching address spaces
}}
174 AS int
*var_cast5
= (AS int
*)arg_gen
;
176 #if
!__OPENCL_CPP_VERSION__
177 // expected-error
@-
3{{casting
'__generic int
*' to type
'__constant int
*' changes address space of pointer
}}
179 // expected-error
@-
5{{C-style cast from
'__generic int
*' to
'__constant int
*' converts between mismatching address spaces
}}
186 #if
!__OPENCL_CPP_VERSION__
187 // expected-error
@-
3{{assigning
'__global int
*__private
' to
'__constant int
*__private
' changes address space of pointer
}}
189 // expected-error
@-
5{{assigning
'__global int
*__private
' to
'__constant int
*' changes address space of pointer
}}
195 #if
!__OPENCL_CPP_VERSION__
196 // expected-error-re
@-
3{{assigning
'__local int
*__private
' to
'__
{{global|constant
}} int
*__private
' changes address space of pointer
}}
198 // expected-error-re
@-
5{{assigning
'__local int
*__private
' to
'__
{{global|constant
}} int
*' changes address space of pointer
}}
202 var_impl
= arg_const
;
204 #if
!__OPENCL_CPP_VERSION__
205 // expected-error-re
@-
3{{assigning
'__constant int
*__private
' to
'__
{{global|generic
}} int
*__private
' changes address space of pointer
}}
207 // expected-error-re
@-
5{{assigning
'__constant int
*__private
' to
'__
{{global|generic
}} int
*' changes address space of pointer
}}
213 #if
!__OPENCL_CPP_VERSION__
214 // expected-error-re
@-
3{{assigning
'__private int
*__private
' to
'__
{{global|constant
}} int
*__private
' changes address space of pointer
}}
216 // expected-error-re
@-
5{{assigning
'__private int
*__private
' to
'__
{{global|constant
}} int
*' changes address space of pointer
}}
222 #if
!__OPENCL_CPP_VERSION__
223 // expected-error-re
@-
3{{assigning
'__generic int
*__private
' to
'__
{{global|constant
}} int
*__private
' changes address space of pointer
}}
225 // expected-error-re
@-
5{{assigning
'__generic int
*__private
' to
'__
{{global|constant
}} int
*' changes address space of pointer
}}
229 var_cast1
= (AS int
*)arg_glob
;
231 #if
!__OPENCL_CPP_VERSION__
232 // expected-error
@-
3{{casting
'__global int
*' to type
'__constant int
*' changes address space of pointer
}}
234 // expected-error
@-
5{{C-style cast from
'__global int
*' to
'__constant int
*' converts between mismatching address spaces
}}
238 var_cast2
= (AS int
*)arg_loc
;
240 #if
!__OPENCL_CPP_VERSION__
241 // expected-error-re
@-
3{{casting
'__local int
*' to type
'__
{{global|constant
}} int
*' changes address space of pointer
}}
243 // expected-error-re
@-
5{{C-style cast from
'__local int
*' to
'__
{{global|constant
}} int
*' converts between mismatching address spaces
}}
247 var_cast3
= (AS int
*)arg_const
;
249 #if
!__OPENCL_CPP_VERSION__
250 // expected-error-re
@-
3{{casting
'__constant int
*' to type
'__
{{global|generic
}} int
*' changes address space of pointer
}}
252 // expected-error-re
@-
5{{C-style cast from
'__constant int
*' to
'__
{{global|generic
}} int
*' converts between mismatching address spaces
}}
256 var_cast4
= (AS int
*)arg_priv
;
258 #if
!__OPENCL_CPP_VERSION__
259 // expected-error-re
@-
3{{casting
'__private int
*' to type
'__
{{global|constant
}} int
*' changes address space of pointer
}}
261 // expected-error-re
@-
5{{C-style cast from
'__private int
*' to
'__
{{global|constant
}} int
*' converts between mismatching address spaces
}}
265 var_cast5
= (AS int
*)arg_gen
;
267 #if
!__OPENCL_CPP_VERSION__
268 // expected-error
@-
3{{casting
'__generic int
*' to type
'__constant int
*' changes address space of pointer
}}
270 // expected-error
@-
5{{C-style cast from
'__generic int
*' to
'__constant int
*' converts between mismatching address spaces
}}
275 int b
= var_cmp
!= arg_glob
;
277 #if
!__OPENCL_CPP_VERSION__
278 // expected-error
@-
3{{comparison between
('__constant int
*' and
'__global int
*') which are pointers to non-overlapping address spaces
}}
280 // expected-error
@-
5{{comparison of distinct pointer types
('__constant int
*' and
'__global int
*')}}
284 b
= var_cmp
!= arg_loc
;
286 #if
!__OPENCL_CPP_VERSION__
287 // expected-error-re
@-
3{{comparison between
('__
{{global|constant
}} int
*' and
'__local int
*') which are pointers to non-overlapping address spaces
}}
289 // expected-error-re
@-
5{{comparison of distinct pointer types
('__
{{global|constant
}} int
*' and
'__local int
*')}}
293 b
= var_cmp
== arg_const
;
295 #if
!__OPENCL_CPP_VERSION__
296 // expected-error-re
@-
3{{comparison between
('__
{{global|generic
}} int
*' and
'__constant int
*') which are pointers to non-overlapping address spaces
}}
298 // expected-error-re
@-
5{{comparison of distinct pointer types
('__
{{global|generic
}} int
*' and
'__constant int
*')}}
302 b
= var_cmp
<= arg_priv
;
304 #if
!__OPENCL_CPP_VERSION__
305 // expected-error-re
@-
3{{comparison between
('__
{{global|constant
}} int
*' and
'__private int
*') which are pointers to non-overlapping address spaces
}}
307 // expected-error-re
@-
5{{comparison of distinct pointer types
('__
{{global|constant
}} int
*' and
'__private int
*')}}
311 b
= var_cmp
>= arg_gen
;
313 #if
!__OPENCL_CPP_VERSION__
314 // expected-error
@-
3{{comparison between
('__constant int
*' and
'__generic int
*') which are pointers to non-overlapping address spaces
}}
316 // expected-error
@-
5{{comparison of distinct pointer types
('__constant int
*' and
'__generic int
*')}}
321 b
= var_sub - arg_glob
;
323 // expected-error
@-
2{{arithmetic operation with operands of type
('__constant int
*' and
'__global int
*') which are pointers to non-overlapping address spaces
}}
326 b
= var_sub - arg_loc
;
328 // expected-error-re
@-
2{{arithmetic operation with operands of type
('__
{{global|constant
}} int
*' and
'__local int
*') which are pointers to non-overlapping address spaces
}}
331 b
= var_sub - arg_const
;
333 // expected-error-re
@-
2{{arithmetic operation with operands of type
('__
{{global|generic
}} int
*' and
'__constant int
*') which are pointers to non-overlapping address spaces
}}
336 b
= var_sub - arg_priv
;
338 // expected-error-re
@-
2{{arithmetic operation with operands of type
('__
{{global|constant
}} int
*' and
'__private int
*') which are pointers to non-overlapping address spaces
}}
341 b
= var_sub - arg_gen
;
343 // expected-error
@-
2{{arithmetic operation with operands of type
('__constant int
*' and
'__generic int
*') which are pointers to non-overlapping address spaces
}}
348 #if
!__OPENCL_CPP_VERSION__
349 // expected-error-re
@-
3{{passing
'__
{{constant|generic
}} int
*__private
' to parameter of type
'__global int
*' changes address space of pointer
}}
351 // expected-error
@-
5{{no matching function for call to
'f_glob
'}}
356 #if
!__OPENCL_CPP_VERSION__
357 // expected-error-re
@-
2{{passing
'__
{{global|constant|generic
}} int
*__private
' to parameter of type
'__local int
*' changes address space of pointer
}}
359 // expected-error
@-
4{{no matching function for call to
'f_loc
'}}
364 #if
!__OPENCL_CPP_VERSION__
365 // expected-error-re
@-
3{{passing
'__
{{global|generic
}} int
*__private
' to parameter of type
'__constant int
*' changes address space of pointer
}}
367 // expected-error
@-
5{{no matching function for call to
'f_const
'}}
372 #if
!__OPENCL_CPP_VERSION__
373 // expected-error-re
@-
2{{passing
'__
{{global|constant|generic
}} int
*__private
' to parameter of type
'__private int
*' changes address space of pointer
}}
375 // expected-error
@-
4{{no matching function for call to
'f_priv
'}}
380 #if
!__OPENCL_CPP_VERSION__
381 // expected-error
@-
3{{passing
'__constant int
*__private
' to parameter of type
'__generic int
*' changes address space of pointer
}}
383 // expected-error
@-
5{{no matching function for call to
'f_gen
'}}
388 void test_ternary
(void) {
390 __generic int
*var_gen
;
391 __global int
*var_glob
;
392 var_gen
= 0 ? var_cond
: var_glob
;
394 #if
!__OPENCL_CPP_VERSION__
395 // expected-error
@-
3{{conditional operator with the second and third operands of type
('__constant int
*' and
'__global int
*') which are pointers to non-overlapping address spaces
}}
397 // expected-error
@-
5{{incompatible operand types
('__constant int
*' and
'__global int
*')}}
401 __local int
*var_loc
;
402 var_gen
= 0 ? var_cond
: var_loc
;
404 #if
!__OPENCL_CPP_VERSION__
405 // expected-error-re
@-
3{{conditional operator with the second and third operands of type
('__
{{global|constant
}} int
*' and
'__local int
*') which are pointers to non-overlapping address spaces
}}
407 // expected-error-re
@-
5{{incompatible operand types
('__
{{global|constant
}} int
*' and
'__local int
*')}}
411 __constant int
*var_const
;
412 var_cond
= 0 ? var_cond
: var_const
;
414 #if
!__OPENCL_CPP_VERSION__
415 // expected-error-re
@-
3{{conditional operator with the second and third operands of type
('__
{{global|generic
}} int
*' and
'__constant int
*') which are pointers to non-overlapping address spaces
}}
417 // expected-error-re
@-
5{{incompatible operand types
('__
{{global|generic
}} int
*' and
'__constant int
*')}}
421 __private int
*var_priv
;
422 var_gen
= 0 ? var_cond
: var_priv
;
424 #if
!__OPENCL_CPP_VERSION__
425 // expected-error-re
@-
3{{conditional operator with the second and third operands of type
('__
{{global|constant
}} int
*' and
'__private int
*') which are pointers to non-overlapping address spaces
}}
427 // expected-error-re
@-
5{{incompatible operand types
('__
{{global|constant
}} int
*' and
'__private int
*')}}
431 var_gen
= 0 ? var_cond
: var_gen
;
433 #if
!__OPENCL_CPP_VERSION__
434 // expected-error
@-
3{{conditional operator with the second and third operands of type
('__constant int
*' and
'__generic int
*') which are pointers to non-overlapping address spaces
}}
436 // expected-error
@-
5{{incompatible operand types
('__constant int
*' and
'__generic int
*')}}
441 __global char
*var_glob_ch
;
442 var_void_gen
= 0 ? var_cond
: var_glob_ch
;
443 #if __OPENCL_CPP_VERSION__
444 // expected-error-re
@-
2{{incompatible operand types
('__
{{constant|global|generic
}} int
*' and
'__global char
*')}}
447 // expected-error
@-
5{{conditional operator with the second and third operands of type
('__constant int
*' and
'__global char
*') which are pointers to non-overlapping address spaces
}}
449 // expected-warning-re
@-
7{{pointer type mismatch
('__
{{global|generic
}} int
*' and
'__global char
*')}}
453 __local char
*var_loc_ch
;
454 var_void_gen
= 0 ? var_cond
: var_loc_ch
;
455 #if __OPENCL_CPP_VERSION__
456 // expected-error-re
@-
2{{incompatible operand types
('__
{{constant|global|generic
}} int
*' and
'__local char
*')}}
459 // expected-error-re
@-
5{{conditional operator with the second and third operands of type
('__
{{global|constant
}} int
*' and
'__local char
*') which are pointers to non-overlapping address spaces
}}
461 // expected-warning
@-
7{{pointer type mismatch
('__generic int
*' and
'__local char
*')}}
465 __constant void
*var_void_const
;
466 __constant char
*var_const_ch
;
467 var_void_const
= 0 ? var_cond
: var_const_ch
;
468 #if __OPENCL_CPP_VERSION__
469 // expected-error-re
@-
2{{incompatible operand types
('__
{{constant|global|generic
}} int
*' and
'__constant char
*')}}
472 // expected-error-re
@-
5{{conditional operator with the second and third operands of type
('__
{{global|generic
}} int
*' and
'__constant char
*') which are pointers to non-overlapping address spaces
}}
474 // expected-warning
@-
7{{pointer type mismatch
('__constant int
*' and
'__constant char
*')}}
478 __private char
*var_priv_ch
;
479 var_void_gen
= 0 ? var_cond
: var_priv_ch
;
480 #if __OPENCL_CPP_VERSION__
481 // expected-error-re
@-
2{{incompatible operand types
('__
{{constant|global|generic
}} int
*' and
'__private char
*')}}
484 // expected-error-re
@-
5{{conditional operator with the second and third operands of type
('__
{{global|constant
}} int
*' and
'__private char
*') which are pointers to non-overlapping address spaces
}}
486 // expected-warning
@-
7{{pointer type mismatch
('__generic int
*' and
'__private char
*')}}
490 __generic char
*var_gen_ch
;
491 var_void_gen
= 0 ? var_cond
: var_gen_ch
;
492 #if __OPENCL_CPP_VERSION__
493 // expected-error-re
@-
2{{incompatible operand types
('__
{{constant|global|generic
}} int
*' and
'__generic char
*')}}
496 // expected-error
@-
5{{conditional operator with the second and third operands of type
('__constant int
*' and
'__generic char
*') which are pointers to non-overlapping address spaces
}}
498 // expected-warning-re
@-
7{{pointer type mismatch
('__
{{global|generic
}} int
*' and
'__generic char
*')}}
503 void test_pointer_chains
(void) {
504 AS int
*AS
*var_as_as_int
;
505 AS int
*AS_COMP
*var_asc_as_int
;
506 AS_INCOMP int
*AS_COMP
*var_asc_asn_int
;
507 AS_COMP int
*AS_COMP
*var_asc_asc_int
;
510 // * address spaces of corresponded most outer pointees overlaps
, their canonical types are equal
511 // * CVR
, address spaces and canonical types of the rest of pointees are equivalent.
512 var_as_as_int
= var_asc_as_int
;
513 var_as_as_int
= 0 ? var_as_as_int
: var_asc_as_int
;
515 // Case
2: Corresponded inner pointees has non-overlapping address spaces.
516 var_as_as_int
= 0 ? var_as_as_int
: var_asc_asn_int
;
517 #if
!__OPENCL_CPP_VERSION__
518 // expected-warning-re
@-
2{{pointer type mismatch
('__
{{(generic|global|constant
)}} int
*__
{{(generic|global|constant
)}} *' and
'__
{{(local|global|constant
)}} int
*__
{{(constant|local|global
)}} *')}}
520 // expected-error-re
@-
4{{incompatible operand types
('__
{{(generic|global|constant
)}} int
*__
{{(generic|global|constant
)}} *' and
'__
{{(local|global|constant
)}} int
*__
{{(constant|local|global
)}} *')}}
523 // Case
3: Corresponded inner pointees has overlapping but not equivalent address spaces.
524 var_as_as_int
= var_asc_asc_int
;
526 #if
!__OPENCL_CPP_VERSION__
527 // expected-error
@-
3 {{assigning
'__local int
*__local
*__private
' to
'__generic int
*__generic
*__private
' changes address space of nested pointer
}}
529 // expected-error
@-
5 {{assigning
'__local int
*__local
*__private
' to
'__generic int
*__generic
*' changes address space of nested pointer
}}
533 var_as_as_int
= (AS int
*AS
*)var_asc_asc_int
;
535 #if
!__OPENCL_CPP_VERSION__
536 // expected-warning
@-
3 {{casting
'__local int
*__local
*' to type
'__generic int
*__generic
*' discards qualifiers in nested pointer types
}}
538 // expected-warning
@-
5 {{C-style cast from
'__local int
*__local
*' to
'__generic int
*__generic
*' changes address space of nested pointers
}}
542 var_as_as_int
= (AS int
*AS
*)var_asc_asn_int
;
543 #if
!__OPENCL_CPP_VERSION__
544 // expected-warning-re
@-
2 {{casting
'__
{{global|local|constant
}} int
*__
{{local|constant|global
}} *' to type
'__
{{global|constant|generic
}} int
*__
{{global|constant|generic
}} *' discards qualifiers in nested pointer types
}}
546 // expected-warning-re
@-
4 {{C-style cast from
'__
{{global|local|constant
}} int
*__
{{local|constant|global
}} *' to
'__
{{global|constant|generic
}} int
*__
{{global|constant|generic
}} *' changes address space of nested pointers
}}
549 var_as_as_int
= 0 ? var_as_as_int
: var_asc_asc_int
;
551 #if
!__OPENCL_CPP_VERSION__
552 // expected-warning
@-
3{{pointer type mismatch
('__generic int
*__generic
*' and
'__local int
*__local
*')}}
554 // expected-error
@-
5 {{incompatible operand types
('__generic int
*__generic
*' and
'__local int
*__local
*')}}