[LLVMdev] allocating an array

HyperQuantum hyperquantum at gmail.com
Wed Jul 16 11:07:02 PDT 2008


How can I allocate an array with a size that is not known at compile time?

The language reference says that the array size must be a constant
integer value. It also says that variable sized arrays are represented
by using zero as the number of elements. Obviously I cannot use zero
in the array type when it is allocated. llvm-gcc seems to use a
pointer type instead of an array type, so compiling a simple C program
that uses an array with a runtime size and looking at the resulting
bitcode didn't provide an answer to my question.


Regards,
Kevin André




More information about the llvm-dev mailing list