OpenCL bug A bug with an If STATEMENT in a FOR LOOP.

Hello Sir/Madame,

Today I have come across a malfunction in my program. The code looks somewhat like this (I’ll only display the piece relevant to my problem):

int i=0, a=0, p=0;

[...]

for(i=0; i<MAX; i++)

	if(i<xmax && i>xmin)

		a++;

[...]

Now, the issue is with the IF STATEMENT. Leaving the IF STATEMENT as it is will result in a malfunction in my kernel; the clEnqueueReadBuffer function returns an error; this buffer has been purposefully created to check whether the kernel is fully functional. However, if I comment out the IF STATEMENT, or if I replace the variable i with p, the buffer will be read properly, which means that the kernel will execute successfully. My first guess is that there is a bug in the OpenCL compiler, since I have encountered a similar problem with the <= operand.

What is your stand on this issue? Has anyone come along with a similar problem?

Thank you for your time,

Best regards,


DD STOSIC.