[LLVMdev] loads from a null address and optimizations

Zoltan Varga vargaz at gmail.com
Sat Sep 5 12:19:23 PDT 2009


                Hi,

  Currently, llvm treats the loads from a null address as unreachable code,
i.e.:
     load i32* null
is transformed by some optimization pass into
    unreachable

This presents problems in JIT compilers like mono which implement null
pointer checks by trapping SIGSEGV signals. It also
looks incorrect since it changes program behavior, which might be undefined
in general, but it is quite well defined on unix.
Is there a way to prevent llvm from doing this besides marking all loads as
volatile ?

                          thanks

                              Zoltan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090905/3cb32915/attachment.html>


More information about the llvm-dev mailing list