[LLVMdev] optimization assumes malloc return is non-null
vda.linux at googlemail.com
Mon Jun 23 07:10:39 PDT 2008
On Thursday 01 May 2008 02:57, David Vandevoorde wrote:
> > Maybe I missed something, but aren't we all talking about the wrong
> > thing
> > here? It seems to me that this isn't about side effects, it's about
> > the
> > return value of malloc. Why can LLVM assume malloc will always return
> > non-zero?
> It cannot assume that in the general case. It can do so here because
> the return value is not used further on.
But it _is_ used to decide what value to return, right?
And this return value sure as hell can affect what will happen
in callers. By assuming arbitrary malloc implementation
you basically can return 0 or 1 value, arbitrarily, here!
This sounds very wrong.
More information about the llvm-dev