OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

Argument of type __local int[5] rejected


The following code fails to compile with the 2013 beta on Linux:

void bar(__local int baz[5]) {}
__kernel void foo() {}

with the message error: parameter may not be qualified with an address space

According to C99: "A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’, where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation." Thus, the parameter to bar ought to be treated as __local int *, which is legal. The same error occurs if no size is provided.

For comparison, the NVIDIA and AMD OpenCL implementations both allow this.

0 Kudos
1 Reply
The OpenCL spec says "Pointers to the __local address space are allowed as arguments to functions (including kernel functions)." and as you already pointed out, according to C99 spec says that the adjustment should be made. I did verify that this kernel fails on the CPU (windows) but compiles on the gpu. I will file a bug and keep you updated. Thanks for bringing this up. Raghu