[LLVMdev] memory bug triggered in getFoldedCast

Rob Nikander rob.nikander at gmail.com
Fri Feb 25 18:51:34 PST 2011


Hi all,

My program is crashing somewhere in LLVM code.  It's one of these
C/C++ memory bugs that I don't have much experience with... having
programmed too much in high level languages.  I'm not sure how to
track it down.  If someone can tell me what could be getting free'd in
the getFoldedCast function, that might help me.   Here is the error
when I run my program:

bamboo(49749) malloc: *** error for object 0x102750a10: incorrect
checksum for freed object - object was probably modified after being
freed.
*** set a breakpoint in malloc_error_break to debug

(I don't know how to use malloc_error_break in this case. ?)

The stack trace in gdb after the above error looks like:

(gdb) bt
#0  0x00007fff81bf8616 in __kill ()
#1  0x00007fff81c98cca in abort ()
#2  0x00007fff81c87901 in szone_error ()
#3  0x00007fff81bb1080 in szone_free_definite_size ()
#4  0x000000010185b577 in getFoldedCast ()
#5  0x0000000101297617 in getAllocArrayFn () at
/Users/rob/Projects/Bamboo/Source/AST.cc:624

The line in my getAllocArrayFn() is:

    return ConstantExpr::getIntToPtr(ci, alloc_args_fn_ptr_type);

ci is a ConstantInt and the other arg is a PointerType (to a FunctionType).

I tried using Apple's Instruments to see what object was allocated
with that address, but I don't see that address in the list of all
object allocations.

If you've got any suggestions, much appreciated.

Rob



More information about the llvm-dev mailing list