in my code when i call findMax function, index variable can't defined but max,i can defined and work. i so try with different names but not works. what is problem?

The CUDA compiler performs some optimizations even when you disable all optimizations. index has no side effect in the device function findMax so the compiler eliminated the variable.
