[llvm-commits] [llvm] r83324 - /llvm/trunk/lib/Analysis/MallocHelper.cpp
Chris Lattner
clattner at apple.com
Tue Oct 6 10:12:46 PDT 2009
On Oct 6, 2009, at 12:12 AM, Duncan Sands wrote:
> 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.
I think it only makes sense to consider something "builtin" if it
follows the C standard. You can't define a 'malloc' with a different
prototype than what the spec indicates (at least without using -ffree-
standing).
-Chris
More information about the llvm-commits
mailing list