"Advisory: Cannot tell what pointer points to"

I get the following warning when I compile:

“Advisory: Cannot tell what pointer points to, assuming global memory space”.

I’m trying to move over some C code to CUDA and when I compile, I get this warning in a number of places… I have pasted one line where it occurs. When I run the program, I get the “failed to launch” message.

if (code1[framepos][1] != *(ptr1[framepos]++))
{
//body
}

code1 and ptr1 are passed in parameters from another device function.

However, when I change the above line to:

if (code1[framepos][1] != (ptr1[framepos][charpos]))
{
//body
}
charpos++;

the code compiles without the warning and the program runs without giving out the “failed to launch error”. The code runs fine in both cases in device emulation mode. Why is there a difference between how the cuda compiler treats both cases? Thanks in advance.

See my code, I got the same err

Thanks, I’ll change the variables to global memory and try it…

In the device function, I have the following code to copy the passed in arg1 member array to storer. arg1 is passed using cudaMalloc and cudaMemcpy.

shared char code1[3];

for (idx = 0; idx < 3; idx++) {

code1[idx] = ‘a’;

}

for (idx = 0; idx < 13; idx++) {

storer[threadIdx.y][threadIdx.x+idx] = arg1.start[idx];

}

//I now have ptr1 pointing to shared memory instead of the passed in structure’s member array.

ptr1 = (const uschar *)(storer[threadIdx.y]);

The below code shows a “Advisory: Cannot tell what pointer points to, assuming global memory space” when compiling.

if (code1[framepos][1] != *(ptr1[framepos]++))

{

//body

}

However, when I change the above line to:

if (code1[framepos][1] != (ptr1[framepos][charpos]))

{

//body

}

charpos++;

the code compiles without the warning and runs without giving the “failed to launch” message.

Please let me know why this is… Thanks.

I’m not sure about the advisory, but are you incrementing ptr1[framepos] by multiple threads? one might update it before the other reads. launch failures are often like segmentation faults. I’ve made similar changes and not gotten rid of the advisory.