[LLVMdev] Need Some Help!

Reid Spencer reid at x10sys.com
Wed Nov 19 18:08:01 PST 2003


On Wed, 2003-11-19 at 16:12, Chris Lattner wrote:
> On Wed, 19 Nov 2003, Reid Spencer wrote:
> 
> > I have a "first version" of Stacker up and running. Structurally its a
> > lot like llvm-as. When I run it, I get:
> > Leaked objects found: after running pass 'Function Pass Manager'
> >   LLVM Value subclasses leaked:
> 
> This is coming from the LLVM "LeakDetector" stuff.  The idea is that you
> are not supposed to create random instructions or basic blocks, then leave
> them hanging around: you should put them into a module somewhere.  :)

Right. Haven't written that part yet :)

> > Note that the supposed list of "LLVM Value subclasses leaked" is empty.
> > Its followed up by a SIGSEGV at AsmWriter.cpp:754 presumably because I
> > have a BasicBlock object not assigned to a Function.
> > Is the message above attempting to tell me this?
> 
> Yeah well, it's trying but failing.  It's attempting to print out the
> thing that has been leaked, but the asmwriter isn't handling the "broken"
> LLVM IR very well.  :(

I actually have a patch for this. AsmWriter is calling
BB->getParent()->xyz without checking that the call to getParent()
doesn't return null. I just put in the check and made it print out
something when it finds that case. The patch is attached.

> 
> > What I can't figure out is where the message comes from and why.
> 
> Basically it's because a BasicBlock has not be inserted into a function.
> If you want to FORCE this to be acceptable, use the
> LeakDetector::removeGarbageObject method in Support/LeakDetector.h
> 
> This is yet another "helpful" LLVM debugging tool, pointing out a silly
> bug.  :)

Cool! It surprised me, but I like this.

Reid.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 1589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20031119/b4bbcc3c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20031119/b4bbcc3c/attachment.sig>


More information about the llvm-dev mailing list