#StackBounty: #python #llvm #llvm-ir #llvmlite Assertion failure in LLVM with LLVMlite

Bounty: 50

(This happened while doing the fix I found here: LLVM IR: expose variables to GDB?)

I am trying to compile some code written in a custom programming language. It is compiled to LLVM IR, and then compiled to an ELF by clang. However, I was trying to add debugging information to a call:

res = self.builder.call(fn, args)
res.set_metadata('dbg', self.module.add_debug_info('DILocation', {
                'line': i.meta.line,
                'column': i.meta.column,
                'scope': self.subprogram
            }))

I got a very nice error: python: /root/miniconda3/conda-bld/llvmdev_1531160641630/work/include/llvm/Support/Casting.h:106: static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::DIBasicType; From = llvm::Metadata]: Assertion 'Val && "isa<> used on a null pointer"' failed. How can I fix this error? I have the latest version of llvmlite: llvmlite==0.26.0

Note: this similar code does not generate any errors:

res = fncall(self.builder, self.module, fn, args).eval()  
# equivalent to self.builder.call(fn, vars, name='called_{0}'.format(fn.name))
res.set_metadata('dbg', self.module.add_debug_info('DILocation', {
                'line': i.meta.line,
                'column': i.meta.column,
                'scope': self.subprogram
            }))

I updated both llvm-6.0, clang-6.0, and llvmlite, and this error still occurs.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.