[LLVMdev] loads from a null address and optimizations

Chris Lattner
Sun, 06 Sep 2009 20:22:16 -0000

On Sep 6, 2009, at 10:52 AM, Bill Wendling wrote:

> The problem he's facing here isn't necessarily one of correctness.
> He's dealing with undefined behavior (at least in C code). There are
> no guarantees that the compiler will retain a certain semantic
> interpretation of an undefined construct between different versions of
> the compiler, let alone different optimization levels.
>
> From what I understand, he wants a particular behavior from the OS (a
> signal). The compiler shouldn't have to worry about OS semantics in
> the face of undefined language constructs. That being said, if he
> wants to implement a couple of passes to change his code, then
> sure. :-)

This is something that LLVM isn't currently good at, but that we're
actively interested in improving.  Here is some related stuff:
http://nondot.org/sabre/LLVMNotes/ExceptionHandlingChanges.txt

I don't know of anyone working on this, or planning to work on it in
the short term though.

-Chris