Here's a test case that causes the access viloation. I realize this is ultimately a user error, but it took me a long while to figure out that the duplicate variables were causing the problem. I didn't associate duplicate variables with the resulting missing loop conditon test.
Also, I'm compiling the kernel source using OpenCL functions clCreateProgramFromSource and clBuildProgram which both return CL_SUCCESS because the diagnostic flagging the duplicate variables is a warning, and so I therefore have no notification that there is a warning diagnostic to look at. Should this diagnostic be an error or are there C/C++ name scoping rules where shadowing a parameter is valid usage?
Thanks for reporting this issue. I feel compiler should give error in this case. I reported this issue to developers.