This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Global null pointer test
- To: "John Carter" <john dot carter at tait dot co dot nz>
- Subject: Re: Global null pointer test
- From: Andi Kleen <ak at suse dot de>
- Date: 19 Jun 2001 05:50:31 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <Pine.LNX.4.32.0106190949240.27111-100000@parore.tait.co.nz.suse.lists.egcs>
"John Carter" <john.carter@tait.co.nz> writes:
> On the otherhand, if that optimization was ever applied to I anything
> that I wrote, I would _much_ rather have a warning than have it
> quietly optimized away.
[...]
As I understand it the main motivation for the NULL pointer test elimination
was that the C++ compiler generates (sometimes redundant) NULL pointer tests
automatically.
> Looking at gcse.c I suspect it would be fairly easy to add a very
> small tweak that spat out a warning (if -Wnull-pointer-test is set) and
> then did the optimization.
It would probably be fairly hard to distingush the case of a compiler
generated NULL pointer test and a user written one there, and it would
be nasty to warn for the first case.
-Andi