[LLVMdev] Verifier should not make any assumptions about calls to "malloc"

Albert Graef Dr.Graef at t-online.de
Tue Sep 22 13:16:23 PDT 2009

Chris Lattner wrote:
> Yes, I agree, the verifier shouldn't worry about malloc calls.
>> Actually isMalloc also seems bogus.  In a freestanding environment
>> there is no reason that a function that happens to be called "malloc"
>> should have anything to do with memory allocation.  Do you have a
>> plan to handle this?  Shouldn't all malloc manipulations be done from
>> SimplifyLibcalls?
> We violate this in other places. If someone is worried about  
> freestanding environments and -fno-builtin-malloc, we should add a new  
> function attribute "not builtin" and have the optimizer respect that.

I'm worried about this, too. Pure does its own extern declarations which
do not line up with malloc() returning int8* either. That's because I
need to distinguish between void* and char* in my frontend, and the
easiest way to do that is to create void* as a different type (it's a
pointer to an empty struct in Pure IIRC). As a consequence, Pure doesn't
work with the assumption that malloc() returns int8*. Now I could
probably work around this in some way, but that's very awkward.


Dr. Albert Gr"af
Dept. of Music-Informatics, University of Mainz, Germany
Email:  Dr.Graef at t-online.de, ag at muwiinfa.geschichte.uni-mainz.de
WWW:    http://www.musikinformatik.uni-mainz.de/ag

More information about the llvm-dev mailing list