This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Global null pointer test


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]