re PR tree-optimization/88367 (-fno-delete-null-pointer-checks doesn't work properly)
authorJakub Jelinek <jakub@gcc.gnu.org>
Thu, 6 Dec 2018 23:28:04 +0000 (00:28 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 6 Dec 2018 23:28:04 +0000 (00:28 +0100)
commitb8a003c16567ccecffce256a2b35c9210db933a4
treecd2b1d9b89ff3acda5dd2a6f6fa1e668e192e7fe
parentff8ba86f447546c57e26bfab2a3437f14d6f2595
re PR tree-optimization/88367 (-fno-delete-null-pointer-checks doesn't work properly)

PR c/88367
* tree-vrp.c (extract_range_from_binary_expr): For POINTER_PLUS_EXPR
with -fno-delete-null-pointer-checks, set_nonnull only if the pointer
is non-NULL and offset is known to have most significant bit clear.
* vr-values.c (vr_values::vrp_stmt_computes_nonzero): For ADDR_EXPR
of MEM_EXPR, return true if the MEM_EXPR has non-zero offset with
most significant bit clear.  If offset does have most significant bit
set and -fno-delete-null-pointer-checks, don't return true even if
the base pointer is non-NULL.

* gcc.dg/tree-ssa/pr88367.c: New test.

From-SVN: r266878
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr88367.c [new file with mode: 0644]
gcc/tree-vrp.c
gcc/vr-values.c