This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA][PR 16361] Add warnings for NULL pointer dereferences and such
- From: Florian Weimer <fweimer at redhat dot com>
- To: Jeff Law <law at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 04 Feb 2014 11:33:37 +0100
- Subject: Re: [RFA][PR 16361] Add warnings for NULL pointer dereferences and such
- Authentication-results: sourceware.org; auth=none
- References: <52E6AED6 dot 6090704 at redhat dot com>
On 01/27/2014 08:09 PM, Jeff Law wrote:
+ if (dereference)
+ warning_at ((gimple_location (use_stmt)
+ ? gimple_location (use_stmt)
+ : gimple_phi_arg_location (phi, i)),
+ OPT_Wnull_dereference,
+ "Potential NULL pointer dereference");
I think warnings should start with a small letter (unless the first word
is capitalized for other reasons). Two more instances follow.
Instead of "Potential invalid NULL argument or return value", "potential
NULL value used in non-NULL context" would be clearer. It would be
really nice if you could add a note that points to the declaration of
non-NULL-ness for the context.
After the change, the third argument to infer_nonnull_range seems always
true, including the call in tre-vrp.c:infer_value_range, so there's a
minor cleanup opportunity.
Looking at infer_nonnull_range, there's an undocumented interaction with
-fdelete-null-pointer-checks.
--
Florian Weimer / Red Hat Product Security Team