2 Replies Latest reply on Feb 8, 2011 1:43 PM by MicahVillmow

    Different address space elements in structs/unions

    nooploop

      Hello,

      reading the restrictions of OpenCL i came across this:

      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.

      So i went and tried the attached code. And the compiler didnt complained. Shouldn't this code be rejected, or atleast shouldn't i get a warning? Or i'm completly wrong and missing something?

       

      union glp { __local int *l; __global int *g; }; struct sglp { __local int *l; __global int *g; }; __kernel void func() { struct sglp x; x.l = 0; x.g = 0; union glp y; y.l = 0; y.g = 0; }