Reference parameters Compiling error


I’m trying to pass a parameter by reference to a function (see below) which will be called from a kernel. However, during compilation I get the following error messages:

Is there anything I’m missing? Why isn’t it working? My fault or compiler bug? I have looked through all available documents, but found nothing which says I can’t do this.

Here’s the code I’m trying to compile:

[codebox]bool RayBoxIntersection(float4 rS,float4 rV, float4 bmin, float4 bmax, float &tnear , float &tfar , float minT)


float4 tmint,tmaxt;

tmint.x = (bmin.x - rS.x)/(rV.x);

tmint.y = (bmin.y - rS.y)/(rV.y);

tmint.z = (bmin.z - rS.z)/(rV.z);

tmaxt.x = (bmax.x - rS.x)/(rV.x);

tmaxt.y = (bmax.y - rS.y)/(rV.y);

tmaxt.z = (bmax.z - rS.z)/(rV.z);

float4 tmin,tmax;

tmin.x = fmin(tmint.x, tmaxt.x);

tmin.y = fmin(tmint.y, tmaxt.y);

tmin.z = fmin(tmint.z, tmaxt.z);

tmin.w = 0.0f;

tmax.x = fmax(tmint.x, tmaxt.x);

tmax.y = fmax(tmint.y, tmaxt.y);

tmax.z = fmax(tmint.z, tmaxt.z);

tmax.w =0.0f;

float tn = fmax(tmin.x, fmax(tmin.y, tmin.z));

float tf = fmin(tmax.x, fmin(tmax.y, tmax.z));

tnear = tn;

tfar = tf;

return ((tn<tf) & (tf>0.0f)  & (tn<minT));


__kernel void TestKernel(__global const float *A)


int nIndex = get_global_id(0);



Can you try with pointers instead of references? I’m not to clear on C99 vs C++, but might not include references.
good luck,

Thanks for your reply, it’s working with pointers. Seems like references aren’t supported in C99…

Since I’m here already, another question. What does

mean? It only happpens when I call a certain function, but the function arguments match everywhere.

Here’s the ptx-code: