Shared pointer to kernel parameter

I’ve got the following code:

[codebox]shared const float* ptr;

if(threadIdx.x == 0)


ptr = p_Param1;


    ptr = p_Param2;

else if(cond)

    ptr = p_Param3;



Where p_Param1-3 are float* parameters of the kernel. Is this legal to do? My kernel fails to execute (cudaThreadSync returns unkown error) and I suspect this piece of code to be the root of this problem. Hope someone can help me.

nm - got the synchronization wrong in my code.