This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

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


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


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