This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Re: Obscure crashes due to gcc 4.9 -O2 => -fisolate-erroneous-paths-dereference
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Daniel Gutson <daniel dot gutson at tallertechnologies dot com>
- Cc: Sandra Loosemore <sandra at codesourcery dot com>, Jeff Prothero <jprother at altera dot com>, gcc Mailing List <gcc at gcc dot gnu dot org>
- Date: Thu, 19 Feb 2015 23:09:46 +0100
- Subject: Re: Re: Obscure crashes due to gcc 4.9 -O2 => -fisolate-erroneous-paths-dereference
- Authentication-results: sourceware.org; auth=none
- References: <pdf61azt48b dot fsf at sj-interactive3 dot altera dot com> <20150218192943 dot GR1746 at tucnak dot redhat dot com> <54E64DFF dot 8030100 at codesourcery dot com> <CAF5HaEU5EUjZJ8O0NEpc2PdNzioUbsjhCO2mh7o_n5Yea8rJTQ at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Feb 19, 2015 at 06:16:05PM -0300, 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
>
> or alike
That would be extremely difficult. The -fdelete-null-pointer-checks option
is used in many places, like the path isolation, value range propagation,
alias oracle, number of iteration analysis etc. E.g. in case of value
range propagation, it is really hard to warn if something has been optimized
some way because of it, because you really don't know the reason why after
all the propagation some SSA_NAME got certain range, to warn you'd
essentially have to do all of VRP twice, once with
-fdelete-null-pointer-checks and once without, and then compare that when
actually performing optimizations. But some optimizations are also done far
later than directly in the VRP pass.
If you have hw where NULL is mapped and you know your code violates the
C/C++ standards by placing objects at that address, simply do use
the option that is designed for that purpose.
Jakub