[LLVMdev] optimization assumes malloc return is non-null

Mike Stump mrs at apple.com
Sun May 4 17:13:20 PDT 2008


On May 2, 2008, at 12:32 PM, David Vandevoorde wrote:
>
> 1.9/6:
> «The observable behavior of the abstract machine is its sequence of
> reads and writes to volatile data and calls to library
> I/O functions. [ Footnote 6: An implementation can offer additional
> library I/O functions as an extension. Implementations that do so
> should treat calls to those functions as “observable behavior” as
> well. ]»
>
> (I wish the C standard were as clear on this topic.)

It is reasonably clear, in that we didn't have to imagine all that  
much or alter all that much to match the C semantics when doing the C+ 
+ standard.  5.1.2.3 describes the details pretty well.  The thing to  
notice is that there is no defined way to tell if a function is  
called, other than I/O or a volatile object, so the entire notion that  
a function call constitutes an observable behavior is just wishy washy  
and because of that, one needs to ignore the idea that functions are  
themselves observable.  Likewise with non-volatile objects.  After  
that, one is left with just volatiles and I/O functions.



More information about the llvm-dev mailing list