This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Obscure crashes due to gcc 4.9 -O2 => -fisolate-erroneous-paths-dereference
- From: Jeff Prothero <jprother at altera dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 19 Feb 2015 17:04:06 -0800
- Subject: Re: Obscure crashes due to gcc 4.9 -O2 => -fisolate-erroneous-paths-dereference
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=softfail (sender IP is 66.35.236.227) smtp dot mailfrom=jprother at altera dot com; gcc.gnu.org; dkim=none (message not signed) header.d=none;
(Thanks to everyone for the helpful feedback!)
Daniel Gutson wrote:
> what about then two warnings (disabled by default), one intended to
> tell the user each time the compiler removes a conditional
> (-fdelete-null-pointer-checks)
> and another intended to tell the user each time the compiler adds a
> trap due to dereference an address 0?
>
> E.g.
> -Wnull-pointer-check-deleted
> -Wnull-dereference-considered-erroneous
I very much like the idea of such warnings.
I'm not clear why one would not warn by default when detecting
non-standards-conformant code and producing code guaranteed not
to do what the programmer intended. But presumably most sane
engineers these days compile with -Wall. :-)
-Jeff