[RFA][PR 16361] Add warnings for NULL pointer dereferences and such

Jeff Law law@redhat.com
Mon Jan 27 22:05:00 GMT 2014

On 01/27/14 14:02, Ian Lance Taylor wrote:
>> We utilize the analysis done for the erroneous-paths optimization.  The
>> optimizations and warnings can be enabled/disabled independently.  The
>> warnings are not enabled by -Wall.
> I want to raise the usual caution about warnings that are based on
> optimizations.  This leads to different results in different GCC
> releases, which makes it hard for other packages to use -Werror.
Absolutely.  It's an issue for any warnings that run after any of the 
optimization passes (as this one does).

There's nothing inherently difficult about running this code earlier, 
say just after entering SSA form.  You'll get a lot more false 
positives, but more stability from release to release.  There's still 
some things that would come and go due to the limited nature of 
following values out of PHI nodes in this code.

I've got the original analyzer here which was designed prior to the 
optimization work.  It actually uses the propagation engine and would 
provide much more warning stability from release to release if it were 
run just after going into SSA form.  It's something I hope to get back 
to during the next stage1 cycle.

> However, I admit that this is less of a concern when the warning is
> not part of -Wall.
Right.  I hadn't actually planned on even doing warnings at this stage, 
but it became pretty clear that something has needed based on the 
reactions to the erroneous-path optimizations.


More information about the Gcc-patches mailing list