Why array size in llvm created by llvm's internal tools is not good enough for llvm?
Posted
by vava
on Stack Overflow
See other posts from Stack Overflow
or by vava
Published on 2010-04-05T11:21:40Z
Indexed on
2010/04/05
11:23 UTC
Read the original article
Hit count: 486
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.
© Stack Overflow or respective owner