re PR c/16351 (NULL dereference warnings)
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 5 Aug 2015 17:36:29 +0000 (17:36 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Wed, 5 Aug 2015 17:36:29 +0000 (17:36 +0000)
commit76787f70097bb232a9bb4afbd9e8c190e57291f0
tree95eb22912610de69685ef6ec213edea83c4c6c6d
parent72a35f9354f285d7ab6211c6c1b71056969f90c7
re PR c/16351 (NULL dereference warnings)

gcc/ChangeLog:

2015-08-05  Manuel López-Ibáñez  <manu@gcc.gnu.org>
    Jeff Law  <law@redhat.com>

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-08-05  Manuel López-Ibáñez  <manu@gcc.gnu.org>
    Jeff Law  <law@redhat.com>

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.

Co-Authored-By: Jeff Law <law@redhat.com>
From-SVN: r226640
15 files changed:
gcc/ChangeLog
gcc/common.opt
gcc/doc/invoke.texi
gcc/gimple-ssa-isolate-paths.c
gcc/gimple.c
gcc/gimple.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c
gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c
gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c
gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c
gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c
gcc/testsuite/gcc.dg/tree-ssa/wnull-dereference.c [new file with mode: 0644]
gcc/tree-vrp.c
gcc/ubsan.c