558 lines · plain
1// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL2.02// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL2.03// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL2.04// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=clc++1.05// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=clc++1.06// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=clc++1.07// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=CL3.0 -cl-ext=+__opencl_c_generic_address_space8// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=CL3.0 -cl-ext=+__opencl_c_generic_address_space9// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=CL3.0 -cl-ext=+__opencl_c_generic_address_space10// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DCONSTANT -cl-std=clc++2021 -cl-ext=+__opencl_c_generic_address_space11// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGLOBAL -cl-std=clc++2021 -cl-ext=+__opencl_c_generic_address_space12// RUN: %clang_cc1 %s -ffake-address-space-map -verify -pedantic -fsyntax-only -DGENERIC -cl-std=clc++2021 -cl-ext=+__opencl_c_generic_address_space13 14/* OpenCLC v2.0 adds a set of restrictions for conversions between pointers to15* different address spaces, mainly described in Sections 6.5.5 and 6.5.6.16*17* It adds notion of overlapping address spaces. The main differention is that18* an unnamed address space is added, called '__generic'. Pointers to the19* generic address space can be interchangabley used with pointers to any20* other address space except for __constant address space (Section 6.5.5).21*22* Based on this there are 3 sets of tests: __generic, named (__global in this23* case), and __constant, that should cover all program paths for CL address24* space conversions used in initialisations, assignments, casts, comparisons25* and arithmetic operations.26*27* OpenCLC v3.0 supports generic address if __opencl_c_generic_address_space feature is supported28*/29 30#ifdef GENERIC31#define AS __generic32#define AS_COMP __local33#define AS_INCOMP __constant34#endif35 36#ifdef GLOBAL37#define AS __global38#define AS_COMP __global39#define AS_INCOMP __local40#endif41 42#ifdef CONSTANT43#define AS __constant44#define AS_COMP __constant45#define AS_INCOMP __global46#endif47 48void f_glob(__global int *arg_glob) {}49#ifndef GLOBAL50#if !__OPENCL_CPP_VERSION__51// expected-note@-3{{passing argument to parameter 'arg_glob' here}}52#else53// 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}}54#endif55#endif56 57void f_loc(__local int *arg_loc) {}58#if !__OPENCL_CPP_VERSION__59// expected-note@-2{{passing argument to parameter 'arg_loc' here}}60#else61// 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}}62#endif63 64void f_const(__constant int *arg_const) {}65#ifndef CONSTANT66#if !__OPENCL_CPP_VERSION__67// expected-note@-3{{passing argument to parameter 'arg_const' here}}68#else69// 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}}70#endif71#endif72 73void f_priv(__private int *arg_priv) {}74#if !__OPENCL_CPP_VERSION__75// expected-note@-2{{passing argument to parameter 'arg_priv' here}}76#else77// 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}}78#endif79 80void f_gen(__generic int *arg_gen) {}81#ifdef CONSTANT82#if !__OPENCL_CPP_VERSION__83// expected-note@-3{{passing argument to parameter 'arg_gen' here}}84#else85// expected-note@-5{{candidate function not viable: cannot pass pointer to address space '__constant' as a pointer to address space '__generic' in 1st argument}}86#endif87#endif88 89void test_conversion(__global int *arg_glob, __local int *arg_loc,90 __constant int *arg_const, __private int *arg_priv,91 __generic int *arg_gen) {92 93 AS int *var_init1 = arg_glob;94#ifdef CONSTANT95#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}}97#else98// expected-error@-5{{cannot initialize a variable of type '__constant int *__private' with an lvalue of type '__global int *__private'}}99#endif100#endif101 102 AS int *var_init2 = arg_loc;103#ifndef GENERIC104#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}}106#else107// expected-error-re@-5{{cannot initialize a variable of type '__{{global|constant}} int *__private' with an lvalue of type '__local int *__private'}}108#endif109#endif110 111 AS int *var_init3 = arg_const;112#ifndef CONSTANT113#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}}115#else116// expected-error-re@-5{{cannot initialize a variable of type '__{{global|generic}} int *__private' with an lvalue of type '__constant int *__private'}}117#endif118#endif119 120 AS int *var_init4 = arg_priv;121#ifndef GENERIC122#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}}124#else125// expected-error-re@-5{{cannot initialize a variable of type '__{{global|constant}} int *__private' with an lvalue of type '__private int *__private'}}126#endif127#endif128 129 AS int *var_init5 = arg_gen;130#ifndef GENERIC131#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}}133#else134// expected-error-re@-5{{cannot initialize a variable of type '__{{global|constant}} int *__private' with an lvalue of type '__generic int *__private'}}135#endif136#endif137 138 AS int *var_cast1 = (AS int *)arg_glob;139#ifdef CONSTANT140#if !__OPENCL_CPP_VERSION__141// expected-error@-3{{casting '__global int *' to type '__constant int *' changes address space of pointer}}142#else143// expected-error@-5{{C-style cast from '__global int *' to '__constant int *' converts between mismatching address spaces}}144#endif145#endif146 147 AS int *var_cast2 = (AS int *)arg_loc;148#ifndef GENERIC149#if !__OPENCL_CPP_VERSION__150// expected-error-re@-3{{casting '__local int *' to type '__{{global|constant}} int *' changes address space of pointer}}151#else152// expected-error-re@-5{{C-style cast from '__local int *' to '__{{global|constant}} int *' converts between mismatching address spaces}}153#endif154#endif155 156 AS int *var_cast3 = (AS int *)arg_const;157#ifndef CONSTANT158#if !__OPENCL_CPP_VERSION__159// expected-error-re@-3{{casting '__constant int *' to type '__{{global|generic}} int *' changes address space of pointer}}160#else161// expected-error-re@-5{{C-style cast from '__constant int *' to '__{{global|generic}} int *' converts between mismatching address spaces}}162#endif163#endif164 165 AS int *var_cast4 = (AS int *)arg_priv;166#ifndef GENERIC167#if !__OPENCL_CPP_VERSION__168// expected-error-re@-3{{casting '__private int *' to type '__{{global|constant}} int *' changes address space of pointer}}169#else170// expected-error-re@-5{{C-style cast from '__private int *' to '__{{global|constant}} int *' converts between mismatching address spaces}}171#endif172#endif173 174 AS int *var_cast5 = (AS int *)arg_gen;175#ifdef CONSTANT176#if !__OPENCL_CPP_VERSION__177// expected-error@-3{{casting '__generic int *' to type '__constant int *' changes address space of pointer}}178#else179// expected-error@-5{{C-style cast from '__generic int *' to '__constant int *' converts between mismatching address spaces}}180#endif181#endif182 183 AS int *var_impl;184 var_impl = arg_glob;185#ifdef CONSTANT186#if !__OPENCL_CPP_VERSION__187// expected-error@-3{{assigning '__global int *__private' to '__constant int *__private' changes address space of pointer}}188#else189// expected-error@-5{{assigning '__global int *__private' to '__constant int *' changes address space of pointer}}190#endif191#endif192 193 var_impl = arg_loc;194#ifndef GENERIC195#if !__OPENCL_CPP_VERSION__196// expected-error-re@-3{{assigning '__local int *__private' to '__{{global|constant}} int *__private' changes address space of pointer}}197#else198// expected-error-re@-5{{assigning '__local int *__private' to '__{{global|constant}} int *' changes address space of pointer}}199#endif200#endif201 202 var_impl = arg_const;203#ifndef CONSTANT204#if !__OPENCL_CPP_VERSION__205// expected-error-re@-3{{assigning '__constant int *__private' to '__{{global|generic}} int *__private' changes address space of pointer}}206#else207// expected-error-re@-5{{assigning '__constant int *__private' to '__{{global|generic}} int *' changes address space of pointer}}208#endif209#endif210 211 var_impl = arg_priv;212#ifndef GENERIC213#if !__OPENCL_CPP_VERSION__214// expected-error-re@-3{{assigning '__private int *__private' to '__{{global|constant}} int *__private' changes address space of pointer}}215#else216// expected-error-re@-5{{assigning '__private int *__private' to '__{{global|constant}} int *' changes address space of pointer}}217#endif218#endif219 220 var_impl = arg_gen;221#ifndef GENERIC222#if !__OPENCL_CPP_VERSION__223// expected-error-re@-3{{assigning '__generic int *__private' to '__{{global|constant}} int *__private' changes address space of pointer}}224#else225// expected-error-re@-5{{assigning '__generic int *__private' to '__{{global|constant}} int *' changes address space of pointer}}226#endif227#endif228 229 var_cast1 = (AS int *)arg_glob;230#ifdef CONSTANT231#if !__OPENCL_CPP_VERSION__232// expected-error@-3{{casting '__global int *' to type '__constant int *' changes address space of pointer}}233#else234// expected-error@-5{{C-style cast from '__global int *' to '__constant int *' converts between mismatching address spaces}}235#endif236#endif237 238 var_cast2 = (AS int *)arg_loc;239#ifndef GENERIC240#if !__OPENCL_CPP_VERSION__241// expected-error-re@-3{{casting '__local int *' to type '__{{global|constant}} int *' changes address space of pointer}}242#else243// expected-error-re@-5{{C-style cast from '__local int *' to '__{{global|constant}} int *' converts between mismatching address spaces}}244#endif245#endif246 247 var_cast3 = (AS int *)arg_const;248#ifndef CONSTANT249#if !__OPENCL_CPP_VERSION__250// expected-error-re@-3{{casting '__constant int *' to type '__{{global|generic}} int *' changes address space of pointer}}251#else252// expected-error-re@-5{{C-style cast from '__constant int *' to '__{{global|generic}} int *' converts between mismatching address spaces}}253#endif254#endif255 256 var_cast4 = (AS int *)arg_priv;257#ifndef GENERIC258#if !__OPENCL_CPP_VERSION__259// expected-error-re@-3{{casting '__private int *' to type '__{{global|constant}} int *' changes address space of pointer}}260#else261// expected-error-re@-5{{C-style cast from '__private int *' to '__{{global|constant}} int *' converts between mismatching address spaces}}262#endif263#endif264 265 var_cast5 = (AS int *)arg_gen;266#ifdef CONSTANT267#if !__OPENCL_CPP_VERSION__268// expected-error@-3{{casting '__generic int *' to type '__constant int *' changes address space of pointer}}269#else270// expected-error@-5{{C-style cast from '__generic int *' to '__constant int *' converts between mismatching address spaces}}271#endif272#endif273 274 AS int *var_cmp;275 int b = var_cmp != arg_glob;276#ifdef CONSTANT277#if !__OPENCL_CPP_VERSION__278// expected-error@-3{{comparison between ('__constant int *' and '__global int *') which are pointers to non-overlapping address spaces}}279#else280// expected-error@-5{{comparison of distinct pointer types ('__constant int *' and '__global int *')}}281#endif282#endif283 284 b = var_cmp != arg_loc;285#ifndef GENERIC286#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}}288#else289// expected-error-re@-5{{comparison of distinct pointer types ('__{{global|constant}} int *' and '__local int *')}}290#endif291#endif292 293 b = var_cmp == arg_const;294#ifndef CONSTANT295#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}}297#else298// expected-error-re@-5{{comparison of distinct pointer types ('__{{global|generic}} int *' and '__constant int *')}}299#endif300#endif301 302 b = var_cmp <= arg_priv;303#ifndef GENERIC304#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}}306#else307// expected-error-re@-5{{comparison of distinct pointer types ('__{{global|constant}} int *' and '__private int *')}}308#endif309#endif310 311 b = var_cmp >= arg_gen;312#ifdef CONSTANT313#if !__OPENCL_CPP_VERSION__314// expected-error@-3{{comparison between ('__constant int *' and '__generic int *') which are pointers to non-overlapping address spaces}}315#else316// expected-error@-5{{comparison of distinct pointer types ('__constant int *' and '__generic int *')}}317#endif318#endif319 320 AS int *var_sub;321 b = var_sub - arg_glob;322#ifdef CONSTANT323// expected-error@-2{{arithmetic operation with operands of type ('__constant int *' and '__global int *') which are pointers to non-overlapping address spaces}}324#endif325 326 b = var_sub - arg_loc;327#ifndef GENERIC328// expected-error-re@-2{{arithmetic operation with operands of type ('__{{global|constant}} int *' and '__local int *') which are pointers to non-overlapping address spaces}}329#endif330 331 b = var_sub - arg_const;332#ifndef CONSTANT333// expected-error-re@-2{{arithmetic operation with operands of type ('__{{global|generic}} int *' and '__constant int *') which are pointers to non-overlapping address spaces}}334#endif335 336 b = var_sub - arg_priv;337#ifndef GENERIC338// expected-error-re@-2{{arithmetic operation with operands of type ('__{{global|constant}} int *' and '__private int *') which are pointers to non-overlapping address spaces}}339#endif340 341 b = var_sub - arg_gen;342#ifdef CONSTANT343// expected-error@-2{{arithmetic operation with operands of type ('__constant int *' and '__generic int *') which are pointers to non-overlapping address spaces}}344#endif345 346 f_glob(var_sub);347#ifndef GLOBAL348#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}}350#else351// expected-error@-5{{no matching function for call to 'f_glob'}}352#endif353#endif354 355 f_loc(var_sub);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}}358#else359// expected-error@-4{{no matching function for call to 'f_loc'}}360#endif361 362 f_const(var_sub);363#ifndef CONSTANT364#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}}366#else367// expected-error@-5{{no matching function for call to 'f_const'}}368#endif369#endif370 371 f_priv(var_sub);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}}374#else375// expected-error@-4{{no matching function for call to 'f_priv'}}376#endif377 378 f_gen(var_sub);379#ifdef CONSTANT380#if !__OPENCL_CPP_VERSION__381// expected-error@-3{{passing '__constant int *__private' to parameter of type '__generic int *' changes address space of pointer}}382#else383// expected-error@-5{{no matching function for call to 'f_gen'}}384#endif385#endif386}387 388void test_ternary(void) {389 AS int *var_cond;390 __generic int *var_gen;391 __global int *var_glob;392 var_gen = 0 ? var_cond : var_glob;393#ifdef CONSTANT394#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}}396#else397// expected-error@-5{{incompatible operand types ('__constant int *' and '__global int *')}}398#endif399#endif400 401 __local int *var_loc;402 var_gen = 0 ? var_cond : var_loc;403#ifndef GENERIC404#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}}406#else407// expected-error-re@-5{{incompatible operand types ('__{{global|constant}} int *' and '__local int *')}}408#endif409#endif410 411 __constant int *var_const;412 var_cond = 0 ? var_cond : var_const;413#ifndef CONSTANT414#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}}416#else417// expected-error-re@-5{{incompatible operand types ('__{{global|generic}} int *' and '__constant int *')}}418#endif419#endif420 421 __private int *var_priv;422 var_gen = 0 ? var_cond : var_priv;423#ifndef GENERIC424#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}}426#else427// expected-error-re@-5{{incompatible operand types ('__{{global|constant}} int *' and '__private int *')}}428#endif429#endif430 431 var_gen = 0 ? var_cond : var_gen;432#ifdef CONSTANT433#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}}435#else436// expected-error@-5{{incompatible operand types ('__constant int *' and '__generic int *')}}437#endif438#endif439 440 void *var_void_gen;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 *')}}445#else446#ifdef CONSTANT447// 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}}448#else449// expected-warning-re@-7{{pointer type mismatch ('__{{global|generic}} int *' and '__global char *')}}450#endif451#endif452 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 *')}}457#else458#ifndef GENERIC459// 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}}460#else461// expected-warning@-7{{pointer type mismatch ('__generic int *' and '__local char *')}}462#endif463#endif464 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 *')}}470#else471#ifndef CONSTANT472// 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}}473#else474// expected-warning@-7{{pointer type mismatch ('__constant int *' and '__constant char *')}}475#endif476#endif477 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 *')}}482#else483#ifndef GENERIC484// 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}}485#else486// expected-warning@-7{{pointer type mismatch ('__generic int *' and '__private char *')}}487#endif488#endif489 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 *')}}494#else495#ifdef CONSTANT496// 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}}497#else498// expected-warning-re@-7{{pointer type mismatch ('__{{global|generic}} int *' and '__generic char *')}}499#endif500#endif501}502 503void 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;508 509 // Case 1:510 // * address spaces of corresponded most outer pointees overlaps, their canonical types are equal511 // * 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;514 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)}} *')}}519#else520// expected-error-re@-4{{incompatible operand types ('__{{(generic|global|constant)}} int *__{{(generic|global|constant)}} *' and '__{{(local|global|constant)}} int *__{{(constant|local|global)}} *')}}521#endif522 523 // Case 3: Corresponded inner pointees has overlapping but not equivalent address spaces.524 var_as_as_int = var_asc_asc_int;525#ifdef GENERIC526#if !__OPENCL_CPP_VERSION__527// expected-error@-3 {{assigning '__local int *__local *__private' to '__generic int *__generic *__private' changes address space of nested pointer}}528#else529// expected-error@-5 {{assigning '__local int *__local *__private' to '__generic int *__generic *' changes address space of nested pointer}}530#endif531#endif532 533 var_as_as_int = (AS int *AS *)var_asc_asc_int;534#ifdef GENERIC535#if !__OPENCL_CPP_VERSION__536// expected-warning@-3 {{casting '__local int *__local *' to type '__generic int *__generic *' discards qualifiers in nested pointer types}}537#else538// expected-warning@-5 {{C-style cast from '__local int *__local *' to '__generic int *__generic *' changes address space of nested pointers}}539#endif540#endif541 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}}545#else546// 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}}547#endif548 549 var_as_as_int = 0 ? var_as_as_int : var_asc_asc_int;550#ifdef GENERIC551#if !__OPENCL_CPP_VERSION__552// expected-warning@-3{{pointer type mismatch ('__generic int *__generic *' and '__local int *__local *')}}553#else554// expected-error@-5 {{incompatible operand types ('__generic int *__generic *' and '__local int *__local *')}}555#endif556#endif557}558