PR tree-optimization/89350 - Wrong -Wstringop-overflow= warning since r261518
authorMartin Sebor <msebor@redhat.com>
Fri, 22 Mar 2019 02:58:27 +0000 (02:58 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Fri, 22 Mar 2019 02:58:27 +0000 (20:58 -0600)
commita411ae9b355c739bf05c065fb2e1b748129c6894
tree723e683acd41429480a4088f1a2c2804fe47ebd8
parent11bf9a075a2d6ba4ee668e785fd2c478fa32f421
PR tree-optimization/89350 - Wrong -Wstringop-overflow= warning since r261518

gcc/ChangeLog:

PR tree-optimization/89350
* builtins.c (compute_objsize): Also ignore offsets whose upper
bound is negative.
* gimple-ssa-warn-restrict.c (builtin_memref): Add new member.
(builtin_memref::builtin_memref): Initialize new member.
Allow EXPR to be null.
(builtin_memref::extend_offset_range): Replace local with a member.
Avoid assuming pointer offsets are unsigned.
(builtin_memref::set_base_and_offset): Determine base object
before computing offset range.
(builtin_access::builtin_access): Handle memset.
(builtin_access::generic_overlap): Replace local with a member.
(builtin_access::strcat_overlap): Same.
(builtin_access::overlap): Same.
(maybe_diag_overlap): Same.
(maybe_diag_access_bounds): Same.
(wrestrict_dom_walker::check_call): Handle memset.
(check_bounds_or_overlap): Same.

gcc/testsuite/ChangeLog:

PR tree-optimization/89350
* gcc.dg/Wstringop-overflow.c: Xfail overly ambitious tests.
* gcc.dg/Wstringop-overflow-11.c: New test.
* gcc.dg/Wstringop-overflow-12.c: New test.
* gcc.dg/pr89350.c: New test.
* gcc.dg/pr40340-1.c: Adjust expected warning.
* gcc.dg/pr40340-2.c: Same.
* gcc.dg/pr40340-4.c: Same.
* gcc.dg/pr40340-5.c: Same.

From-SVN: r269867
13 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/gimple-ssa-warn-restrict.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Warray-bounds-40.c
gcc/testsuite/gcc.dg/Wstringop-overflow-11.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wstringop-overflow-12.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wstringop-overflow.c
gcc/testsuite/gcc.dg/pr40340-1.c
gcc/testsuite/gcc.dg/pr40340-2.c
gcc/testsuite/gcc.dg/pr40340-4.c
gcc/testsuite/gcc.dg/pr40340-5.c
gcc/testsuite/gcc.dg/pr89350.c [new file with mode: 0644]