AllenShow via llvm-dev
2015-Nov-28 12:40 UTC
[llvm-dev] Unknown constant pointer type error when using BlockAddress
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>
Jeremy Lakeman via llvm-dev
2015-Nov-29 00:53 UTC
[llvm-dev] Unknown constant pointer type error when using BlockAddress
Are you mixing context objects? That might cause a weird issue like this. On Sat, Nov 28, 2015 at 11:10 PM, AllenShow via llvm-dev < llvm-dev at lists.llvm.org> wrote:> 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. > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151129/13b4da69/attachment.html>