PR tree-optimization/91183 - strlen of a strcpy result with a conditional source...
authorMartin Sebor <msebor@redhat.com>
Thu, 25 Jul 2019 00:29:17 +0000 (00:29 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Thu, 25 Jul 2019 00:29:17 +0000 (18:29 -0600)
commitb631bdb3c16e85f35d38e39b3d315c35e4a5747c
tree946823534c8cde2d83143cbdcd1e5d6e8d8d7955
parent7214f11d4708a62868f4b0830ef65b87976d1826
PR tree-optimization/91183 - strlen of a strcpy result with a conditional source not folded

PR tree-optimization/91183 - strlen of a strcpy result with a conditional source not folded
PR tree-optimization/86688 - missing -Wstringop-overflow using a non-string local array in strnlen with excessive bound

gcc/ChangeLog:

PR tree-optimization/91183
PR tree-optimization/86688
* builtins.c (compute_objsize): Handle MEM_REF.
* tree-ssa-strlen.c (class ssa_name_limit_t): New.
(get_min_string_length): Remove.
(count_nonzero_bytes): New function.
(handle_char_store): Rename...
(handle_store): to this.  Handle multibyte stores via integer types.
(strlen_check_and_optimize_stmt): Adjust conditional and the called
function name.

gcc/testsuite/ChangeLog:

PR tree-optimization/91183
PR tree-optimization/86688
* gcc.dg/Wstringop-overflow-14.c: New test.
* gcc.dg/attr-nonstring-2.c: Remove xfails.
* gcc.dg/strlenopt-70.c: New test.
* gcc.dg/strlenopt-71.c: New test.
* gcc.dg/strlenopt-72.c: New test.
* gcc.dg/strlenopt-8.c: Remove xfails.

From-SVN: r273783
gcc/ChangeLog
gcc/builtins.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/object-size-9.c
gcc/testsuite/gcc.dg/Wstringop-overflow-14.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/attr-nonstring-2.c
gcc/testsuite/gcc.dg/strlenopt-70.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-71.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-72.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-8.c
gcc/tree-ssa-strlen.c