tinny bug with naming conflict

Tiny thing, but it caused me a headake for almost an hour in my bigger project.

Although nvcc did thow warning messages, I didn’t see them at first among lots of other messages.

Note - without extra curly braces, nvcc will correctly report an error during compilation.


global void doSomething(float *c, int step) {




int step=0;



int main() {




At the end of kernel call there should be 2 stored under someFloatPointer. Unfortunately, compiler tries to access local variable ‘step’, which is not even declared, instead of function argument, and sets some garbage to c[0].

Commenting instructions after ‘return’ brings back correct behaviour.