Why array size in llvm created by llvm's internal tools is not good enough for llvm?
- by vava
I'm getting strange error message from the following code:
ArrayType * arrayType = ArrayType::get(Type::getInt32Ty(ctx), 0);
stack = builder->CreateAlloca(arrayType,
ConstantArray::get(arrayType,
std::vector<Constant *>()));
This code compiles fine but it gives me
llvm::Value* getAISize(llvm::LLVMContext&, llvm::Value*):
Assertion `Amt-getType() == Type::getInt32Ty(Context)
&& "Malloc/Allocation array size is not a 32-bit integer!"' failed.
during execution.
What's interesting, is that I never said of what type array size should be, it was created somewhere inside helper functions. So I naturally see no good reason for assert to be there.
But I must be doing something wrong anyway, can you help me spot the problem?
Thanks in advance.
PS. LLVM, as good as it is, lacking documentation tremendously.