PDA

View Full Version : Pointers to arrays



IRWolfie-
03-28-2011, 09:29 AM
I have an array of pointers to global inside a function, I'm having issues with having a pointer then to this array.
For example if I have
global double2 * Start[SIZE];

I get errors when I try to pass it as (global double2 **) argument to a function.
Are these errors from the specific implementation or am I doing things incorrectly?

Error Message:

Call parameter type does not match function signature!
%ptr210 = getelementptr inbounds [6 x <2 x double> addrspace(1)*]* %Start, i32 0, i32 0 ; <<2 x double> addrspace(1)**> [#uses=1]
<2 x double> addrspace(1)* addrspace(1)* %call216 = call i32 @func(<2 x double> addrspace(1)** %ptr210) nounwind ; <i32> [#uses=0]
Broken module found, compilation aborted!
Stack dump:
0. Running pass 'Module Verifier' on function '@__OpenCL_Main_kernel'
Aborted

note: I am not passing it as a kernel function

david.garcia
03-28-2011, 03:01 PM
I get errors when I try to pass it as (global double2 **) argument to a function.
Are these errors from the specific implementation or am I doing things incorrectly?

From section 6.8 of the specification:


Arguments to __kernel functions in a program cannot be declared as a pointer to a pointer(s). Variables inside a function or arguments to non __kernel functions in a program can be declared as a pointer to a pointer(s)

IRWolfie-
03-29-2011, 03:00 AM
As I have already mentioned it's not an argument to a kernel function. so therefore it's an implementation error?

david.garcia
03-29-2011, 05:37 AM
Right, it's an implementation bug:


Variables inside a function [this includes kernel functions] or arguments to non __kernel functions in a program can be declared as a pointer to a pointer(s)

IRWolfie-
03-29-2011, 06:23 AM
Cheers: ati v2.2 update to ati v2.3 solved the issue