[PATCH] D58236: Make address space conversions a bit stricter.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 27 10:29:09 PST 2019

rjmccall added inline comments.

Comment at: test/SemaOpenCL/address-spaces.cl:87
+  // FIXME: This doesn't seem right. This should be an error, not a warning.
+  __local int * __global * __private * lll;
Anastasia wrote:
> ebevhan wrote:
> > Anastasia wrote:
> > > Are we sure it has to be an error? May be we can change this wording to something like - unknown behavior that needs clarifying? Some similar text to your comment in the code.
> > Well... If `__private int **` to `__generic int **` is an error but `__private int ***` to `__generic int **` isn't, that seems a bit odd to me...
> > 
> Ok, I am still confused about this case because it's converting number of pointers. It's not exactly the same to me as converting address spaces of pointers. Since `__generic` is default addr space in OpenCL, in your example following 2 inner address spaces seem to match:
> `__private int * __generic* __generic*` -> `__generic int * __generic*`
> But in any case keeping FIXME is definitely the right thing to do here until we come up with some sort of rules.
For reasons that have always been obscure to me, Clang is very permissive about pointer-type changes in C, far more than the C standard actually requires.  It's hard to change that in general, but I think it's fine to harden specific new cases like nested address-space conversions.



More information about the cfe-commits mailing list