PING: https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01860.html Actually, the xfailed test was because the function folded to nothing and the offending code was removed without warning. Fixed in the attached version. Same changelog. On 22 July 2015 at 17:52, Manuel López-Ibáñez wrote: > I took the patch in > https://gcc.gnu.org/ml/gcc-patches/2014-01/msg01715.html and removed > the Wnull-attribute part, since most of it can be done from the FE as > shown in https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01857.html and > also to make the patch smaller and easier to review. > > I also fixed the comments by Florian here: > https://gcc.gnu.org/ml/gcc-patches/2014-02/msg00149.html and added > more tests from the PR and its duplicates (one xfailed, I'll open a > new PR about it). > > Futher cleanups may be possible (infer_nonnull_range_by_attribute > checks flag_delete_null_pointer_checks, which seems weird to me but it > matches the existing behavior of infer_nonnull_range). > > I added this to Wall to get as much testing as possible, we can always > move it to Wextra or disable it by default just before the release if > it turns out to be too noisy. > > Boostrapped and regression tested on x86_64-linux-gnu. > > OK? > > gcc/ChangeLog: > > 2015-07-22 Manuel López-Ibáñez > Jeff Law > > PR c/16351 > * doc/invoke.texi (Wnull-dereference): New. > * tree-vrp.c (infer_value_range): Update call to infer_nonnull_range. > * gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour): > Warn for potential NULL dereferences. > (find_explicit_erroneous_behaviour): Warn for NULL dereferences. > * ubsan.c (instrument_nonnull_arg): Call > infer_nonnull_range_by_attribute. > (instrument_nonnull_return): Likewise. > * common.opt (Wnull-dereference); New. > * gimple.c (infer_nonnull_range): Remove bool arguments. > (infer_nonnull_range_by_dereference): New. > (infer_nonnull_range_by_attribute): New. > * gimple.h: Update declarations. > > gcc/testsuite/ChangeLog: > > 2015-07-22 Manuel López-Ibáñez > Jeff Law > > PR c/16351 > * gcc.dg/tree-ssa/isolate-2.c: Close comment. > * gcc.dg/tree-ssa/isolate-4.c: Likewise. > * gcc.dg/tree-ssa/wnull-dereference.c: New test. > * gcc.dg/tree-ssa/isolate-1.c: Test warnings with -Wnull-dereference. > * gcc.dg/tree-ssa/isolate-3.c: Likewise. > * gcc.dg/tree-ssa/isolate-5.c: Likewise. > * c-c++-common/wnonnull-1.c: New test.