[llvm-dev] Unknown constant pointer type error when using BlockAddress

AllenShow via llvm-dev llvm-dev at lists.llvm.org
Sat Nov 28 04:40:26 PST 2015


Hi, all

I try to run codes below to get a block address (not entry block)

BasicBlock *bb = BasicBlock::Create(context, "label", func);
Value *alloca = builder.CreateAlloca(builder.getInt8PtrTy(), 0);
builder.CreateStore(BlockAddress::get(bb), alloca);
But every time I get an error:

Unknown constant pointer type!
UNREACHABLE executed at /tmp/llvm20150903-18194-1kmlx72/llvm-3.6.2.src/lib/ExecutionEngine/ExecutionEngine.cpp:825!
Abort trap: 6
It is wired that this problem only happens if I use ExecutableEngine.runFunctionAsMain to run func
If I dump my codes to a llvm IR file first and use llvm tool lli to run IR file, it works

Is it a just-in-time problem ? I am confused.

Thanks, Allen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151128/d4a4e783/attachment.html>


More information about the llvm-dev mailing list