[LLVMdev] interesting possible compiler bug

Chris Lattner clattner at apple.com
Mon Oct 15 17:49:36 PDT 2012


On Oct 15, 2012, at 5:27 PM, Krzysztof Parzyszek <kparzysz at codeaurora.org> wrote:

> On 10/15/2012 7:20 PM, Chris Lattner wrote:
>> 
>> You've made a number of claims on this thread, but I'm not sure what you're basing these claims on - certainly not the C standard.
>> 
>> If you don't want the compiler to touch well known functions like malloc, build with -fno-builtin and you'll get the behavior you want.
> 
> The only claim you can object to is about side-effects.  It was more of a general remark, but yes, the compiler can delete calls where the result is not used.  This is indeed a case of a "dead malloc", which Eli pointed out.
> 
> Is there anything else you disagree with?

I'm pointing out that you're making strong claims without backing them up by anything.  For example "malloc is not known to always return a non-null pointer" is true, but not pertinent.  "malloc has side-effects and hence cannot be eliminated" is not true.

-Chris




More information about the llvm-dev mailing list