This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/33651] New: Request warning on null pointer chk optimized after ptr deref
- From: "david_albert at axiometric dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Oct 2007 00:09:51 -0000
- Subject: [Bug c/33651] New: Request warning on null pointer chk optimized after ptr deref
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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