This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: New pass to delete unexecutable paths in the CFG
- From: Tom Tromey <tromey at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 07 Nov 2011 06:53:26 -0700
- Subject: Re: RFA: New pass to delete unexecutable paths in the CFG
- References: <4EB7AAF6.6060702@redhat.com>
>>>>> "Jeff" == Jeff Law <law@redhat.com> writes:
Jeff> First, it's perfectly fine to have a NULL pointer dereference in a
Jeff> program as long as that code is never executed. Once the code is
Jeff> executed, we've entered the realm of undefined behavior.
Jeff> Thus in a conforming program we can safely assume that a provable NULL
Jeff> pointer dereference can never be executed at runtime. This implies
Jeff> there is a path through the CFG that is unexecutable.
IIUC, then this isn't true for Java. In Java the attempt to dereference
NULL throws a NullPointerException, which can be caught, etc. It isn't
undefined.
Tom