[LLVMdev] Possible Bad Assertion in Value.cpp

John Criswell criswell at cs.uiuc.edu
Fri Feb 15 14:43:06 PST 2008


Chris Lattner wrote:
> On Feb 15, 2008, at 1:57 PM, John Criswell wrote:
>
>   
>> Dear All,
>>
>> I'm getting the following assertion from a program I've written:
>>
>> /home/vadve/criswell/src/llvm22/lib/VMCore/Value.cpp:57: virtual
>> llvm::Value::~Value(): Assertion `use_empty() && "Uses remain when a
>> value is destroyed!"' failed.
>>
>> This occurs when I free a Module (the program uses an auto_ptr() to
>> the
>> Module, and the auto_ptr() moves out of scope).
>>
>> It looks like the code that frees a BasicBlock frees all of its
>> instructions in order without regards to the def-use chains.  However,
>> the Value class's destructor has the assertion that the Value has no
>> uses.
>>
>> Is the assertion an error, or should BasicBlock's deallocate
>> instructions so that there are no dangling def-use chains?
>>     
>
> You probably have an instruction that you removed from the module but
> didn't delete.  The module dtor works fine: it uses
> 'dropAllReferences' to clear the operands of instructions before
> deleting the instructions themselves.
>   
Okay.  I wasn't aware I had to delete unneeded values as well as remove 
them.  I'll try that.

Thanks.

-- John T.

> -Chris
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list