[cfe-commits] [PATCH] OpenCL error for elements in a struct

Tanya Lattner lattner at apple.com
Thu Jun 14 11:13:49 PDT 2012


On Jun 14, 2012, at 5:38 AM, Peter Collingbourne wrote:

> On Thu, Jun 14, 2012 at 12:08:56PM +0100, Anton Lokhmotov wrote:
>> Hi Tanya,
>> 
>>> OpenCL does not allow elements of a struct to be in different address
>>> spaces. The attached patch checks for this and throws an error. It
>>> includes a test case.
>> 
>> I can see how your patch attempts to directly support the following
>> restriction in the spec:
>> 
>> "Elements of a struct or union must belong to the same address space.
>> Declaring a struct
>> or union whose elements are in different address spaces is illegal."
>> 
>> (Seems to be unchanged since OpenCL v1.0; 6.8.o in OpenCL v1.1).
>> 
>> However, I think it's a flaw in the spec as elements of a struct or union
>> should not have any address space qualifiers.
> 
> Hi Anton,
> 
> I agree.  Has this been reported as a defect in the specification?
> I could not find anything in the public bug tracker.

If you guys want to take this up with Khronos, then please do. Until then, I'd like to commit this to Clang as it does adhere to the spec.

Thanks,
Tanya

> 
> Thanks,
> -- 
> Peter




More information about the cfe-commits mailing list