Passing pointers to pointers to JIT

Hey,

we're trying to pass multidimensional arrays to JIT where one of the helper
functions should convert them to LLVM vector types. Unfortunately passing a
multidimensional array seems to crash the JIT and I'm not sure why.

As an example, we have a file with two silly C functions:
http://ktown.kde.org/~zrusin/llvm/llvm.c
Both clang (latest svn) and llvm-gcc (4.0.1) produce basically the same ll
code looking like this:
http://ktown.kde.org/~zrusin/llvm/llvm.ll
And now calling those functions from a cpp file looking like this:
http://ktown.kde.org/~zrusin/llvm/test.cpp
gives proper results for the single-dimensional array, but crashes on
multi-dimensional case.

It looks like argument passing to those functions with the:
std::vector<GenericValue> args(2);
args[0] = PTOGV(array);
args[1].IntVal = APInt(32, arraySize);
scheme is ok when "array" is single dimensional but invalid when "array" is
multi-dimensional.

What is the proper way of passing multi-dimensional arrays from C/C++ code to
LLVM JIT? If someone could let me know what I'm doing wrong and how to get
this to work, that'd be great. Or alternatively does anyone have a function
that would convert arrays of the form float[n][4] into array of vectors of
[n x <4 x float>] format and back?

Zack

Of course passing the right type actually helps. As Anton pointed out to me on
IRC this is a [4 x float]* and not float**. Sorry about the noise.

Zack