Strange error compiling OpenCL kernel.

clBuildProgram() returns CL_OUT_OF_RESOURCES for a very simple kernel. As soon as I add “-cl-nv-verbose” to the compiler flags to see what’s going on, the CL_OUT_OF_RESOURCES is gone and clBuildProgram returns CL_SUCCESS. Is this a known nvidia opencl compiler bug? I reduced the kernel to the simplest I could which would still show this behaviour:

__kernel void Test(__read_only image2d_t inImage,
__write_only image2d_t outImage
)
{
uint xin = get_global_id(0);
uint yin = get_global_id(1);

sampler_t sampler = CLK_FILTER_NEAREST | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_NORMALIZED_COORDS_FALSE;

uint4 color = 0;

for (int y = -3; y < 4; y++)
{
	for (int x= -3; x < 4; x++)
	{
		color += read_imageui(inImage, sampler, (int2)(xin+x, yin+y));
	}
}

color /= 49;


for (int y = 0; y < 4; y++)
{
	for (int x = 0; x < 4; x++)
	{
		write_imageui(outImage, (int2)(4*xin+x, 4*yin+y), color);
	}
}

}