[LLVMdev] optimization assumes malloc return is non-null
Jonathan S. Shapiro
shap at eros-os.com
Wed Apr 30 18:37:17 PDT 2008
On Wed, 2008-04-30 at 21:01 -0400, David Vandevoorde wrote:
> On Apr 30, 2008, at 8:47 PM, Jonathan S. Shapiro wrote:
> > Since the effect of malloc is not captured, the entire malloc can be
> > discarded. Any call to malloc that is discarded can be presumed
> > (arbitrarily) to succeed, and therefore to return non-null.
>
>
> Correct. It's an extreme form of garbage collection, I suppose ;-)
>
> (In theory, it can also be assumed to fail -- because an
> implementation is allowed to make any call to malloc fail -- though
> that's probably not useful.)
I think it cannot in general assume that in this case, for reasons
outlined in my other note.
More information about the llvm-dev
mailing list