HarryH

Two clBuildProgram bugs

Discussion created by HarryH on Aug 16, 2010
Latest reply on Sep 14, 2010 by MicahVillmow

I found the following 2 bugs / non-compliance cases:

Bug 1 ===== The OpenCL C compiler suppresses warnings unless there are build errors, The "-Werror" compile option is not recognized. (OpenCL 1.1 specification 5.6.3.4 pg. 116) An extra comma was introduced before the last parenthesis in kernel "bug1" to trigger the error, which also triggered the warnings. If the comma is removed the kernel compiles without errors or warnings. Bug 2 ===== In kernel "bug2" the constant expression used to dimension array x is not recognized as constant as per the C99 spec. When compiled as a C function (without the __kernel qualifier) with: gcc -c -std=c99 bug2.c the function compiles OK. All examples below were compiled with following statement: status = clBuildProgram(program, 1, &Device, "-Werror", NULL, NULL); *** Bug 1 ************************************************** __kernel void bug1(void) { float x = 0.0; , } Error in clBuildProgram: CL_BUILD_PROGRAM_FAILURE Warning: invalid option: -Werror /tmp/OCLpJs6Ll.cl(3): warning: double-precision constant is represented as single-precision constant because double is not enabled float x = 0.0; ^ /tmp/OCLpJs6Ll.cl(4): error: expected an expression , ^ /tmp/OCLpJs6Ll.cl(5): error: expected a ";" } ^ /tmp/OCLpJs6Ll.cl(3): warning: variable "x" was declared but never referenced float x = 0.0; ^ 2 errors detected in the compilation of "/tmp/OCLpJs6Ll.cl". *** Bug 2 ************************************************** __kernel void bug2(void) { const int maxnum = 8; float x[maxnum]; } Error in clBuildProgram: CL_BUILD_PROGRAM_FAILURE Warning: invalid option: -Werror /tmp/OCLrB9JQs.cl(4): error: expression must have a constant value float x[maxnum]; ^ 1 error detected in the compilation of "/tmp/OCLrB9JQs.cl".

Outcomes