Cuda 3.2 Memory Kernel Error

Hello All,

I am having a weird problem in a kernel where I am assigning a certain value for a variable “mm” that varies in a loop.

This mm is then used as an index for an array pointer that is already loaded.

In many cases if the variable “mm” exceeds a certain limit, the program crashes giving some errors like:

First-chance exception and Microsoft C++ exception: cudaError_enum at memory location

The weird part is that if mm was fixed even for a much higher number, the program works well.

This is the main code that cause the crash:

mm=i*480;

					if(mm>=100000) 

						{

							rd = ptr2[1];

					}

					else

					{

						rd = ptr2[mm]; //

// Note that if this was fixed to even a higher value like 100001, no problem then

					};