[Bug c/33651] New: Request warning on null pointer chk optimized after ptr deref

david_albert at axiometric dot com gcc-bugzilla@gcc.gnu.org
Thu Oct 4 00:10:00 GMT 2007


With -O2 and above, the optimizer will remove null pointer checks after the
pointer has been de-referenced.  This makes assumptions about the run-time
environment: that de-referencing address 0 is illegal and will cause an MMU
fault.  This assumption is invalid in some environments such as those where
address 0 contains a table that may be legitimately accessed.  The removal of
subsequent null pointer checks results in potentially serious object code
generation errors for valid C input code.

Please add a warning on removal of null pointer checks following de-reference
of that pointer.

ref. c/33629


-- 
           Summary: Request warning on null pointer chk optimized after ptr
                    deref
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: david_albert at axiometric dot com
 GCC build triplet: 4.2.0
  GCC host triplet: i686-pc-cygwin
GCC target triplet: arm-elf-gcc


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33651



More information about the Gcc-bugs mailing list