[llvm-commits] [llvm] r83324 - /llvm/trunk/lib/Analysis/MallocHelper.cpp

Duncan Sands baldrick at free.fr
Tue Oct 6 00:12:30 PDT 2009


Hi Chris,

>>> +  // Check malloc prototype.
>>> +  // FIXME: this will be obsolete when nobuiltin attribute will exist.
>>
>> why would it be obsolete then?  If LLVM sees "malloc" with a funky
>> prototype it will always need to bail out, no?
> 
> Why would it in this case?  Though it doesn't make a lot of sense, it 
> wouldn't cause the program to crash, and the code would have undefined 
> behavior.

if the standard malloc for some operating system has an unusual 
prototype, for example it returns more info than usual malloc, then
it is still a builtin, just a builtin that LLVM doesn't understand
yet.  I don't see why it shouldn't be marked with a "builtin" attribute.
A "builtin" attribute presumably wouldn't be for marking functions
that LLVM knows about, but for marking standard functions.  LLVM may
or may not know about any particular function or particular standard.
That said, I appreciate that there are limits to this line of reasoning.

Ciao,

Duncan.



More information about the llvm-commits mailing list