[LLVMdev] loads from a null address and optimizations

Duncan Sands baldrick at free.fr
Mon Sep 7 03:24:42 PDT 2009

Hi Andrew,

> We faced this problem in gcc, and unfortunately Java and Ada have different
> properties when it comes to trapping instructions: Java must throw a
> NullPointerException at the appropriate place, but AIUI Ada may or may not.

in the case of Ada, throwing an exception at the appropriate place is
always fine.  The language standard does allow the compiler to perform
some optimizations which may result in the exception being thrown
somewhere else, but of course the compiler isn't obliged to perform
these optimizations.  In summary: it is always right to throw the
exception at the obvious place, but it is not necessarily wrong if it is
thrown somewhere else.



More information about the llvm-dev mailing list