Compiling with GPU debug information inexplicable first chance exceptions

Hi. I am having trouble getting things to run properly when the code is compiled with GPU debug information. Inexplicable errors are thrown, and I narrowed it down, from quite a large piece of code to a single line, where I use a functor inside a device function. The code runs quite well when compiled without the gpu debug information (EDIT: I get this problem only when I try to GPU debug). It makes me wonder if the problem is really there or it is a bug with the debugger… here’s a sample of the error I am getting:

First-chance exception at 0x7661b9bc in cudaCLAW.exe: Microsoft C++ exception: cudaError_enum at memory location 0x002af708..

First-chance exception at 0x7661b9bc in cudaCLAW.exe: Microsoft C++ exception: cudaError_enum at memory location 0x002af714..

First-chance exception at 0x7661b9bc in cudaCLAW.exe: Microsoft C++ exception: cudaError_enum at memory location 0x002af674..

First-chance exception at 0x7661b9bc in cudaCLAW.exe: Microsoft C++ exception: cudaError_enum at memory location 0x002af708..

First-chance exception at 0x7661b9bc in cudaCLAW.exe: Microsoft C++ exception: cudaError_enum at memory location 0x002af684..

First-chance exception at 0x7661b9bc in cudaCLAW.exe: Microsoft C++ exception: cudaError_enum at memory location 0x002af670..

and this is essentially the device function:

template<..., class Limiter>

__device__ real limiting (Limiter phi, ...)

{

        real var;

	// update var, legal short code

	if (/*...*/)

		return (real)0.0f;

	return phi(var); <------------ commenting this line out and replacing it with some constant return runs just fine with the debug info!

}

The functor phi doesnt read any memory location except the given argument and returns a real.

I can’t explain this, if anybody out there can please let me know what’s going on. Thanks.