Anastasia added a comment.

> Along those lines, in general, the normal C rules should allow casting `foo*` 
> to `bar*` for any object types foo and bar, even if foo and bar are pointers 
> with address spaces, like `__local int *` and `__global int *`.  I don't see 
> anything in the OpenCL standard that would contradict this.  It looks like 
> this patch changes that?

s6.5 of OpenCL spec is very explicit about this case: "A pointer  to  address  
space  A  can  only  be  assigned  to  a  pointer  to  the  same  address  
space  A  or  a pointer  to  the  generic  address  space.  Casting  a  pointer 
 to  address  space  A  to  a  pointer  to  address space B is illegal if A and 
B are named address spaces and A is not the same as B". Although there is a 
typo with missing first occurrence of B.

The behavior with generic is explained in s6.5.5.

Btw, this patch doesn't change anything in the address space conversions of 
pointers in OpenCL in general but just changes the behavior of nested pointers 
for which spec doesn't say anything. I think trying to reject code that is 
doing something dangerous is a good thing!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58236/new/

https://reviews.llvm.org/D58236



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to