PR tree-optimization/86043 - strlen after memcpy partially overwriting a string not...
authorMartin Sebor <msebor@redhat.com>
Thu, 26 Jul 2018 16:45:43 +0000 (16:45 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Thu, 26 Jul 2018 16:45:43 +0000 (10:45 -0600)
commitaca8570e11d28b8c33d26593df6d4725a6140aab
treebea2270f62332f8d85e1bcd3adcb0c246cb32648
parent4b8b1f5997e7f16713be5c05e7fd40c122fa9381
PR tree-optimization/86043 - strlen after memcpy partially overwriting a string not optimized

PR tree-optimization/86043 - strlen after memcpy partially overwriting a string not optimized
PR tree-optimization/86042 - missing strlen optimization after second strcpy

gcc/ChangeLog:

PR tree-optimization/86043
PR tree-optimization/86042
* tree-ssa-strlen.c (handle_builtin_memcpy): Handle strict overlaps.
(get_string_cst_length): Rename...
(get_min_string_length): ...to this.  Add argument.
(handle_char_store): Extend to handle multi-character stores by
MEM_REF.
* tree.c (initializer_zerop): Use new argument.  Handle MEM_REF.
* tree.h (initializer_zerop): Add argument.

gcc/testsuite/ChangeLog:

PR tree-optimization/86043
PR tree-optimization/86042
* gcc/testsuite/gcc.dg/attr-nonstring-2.c: Xfail test cases due to
pr86688.
* gcc.dg/strlenopt-44.c: New test.

From-SVN: r263018
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/attr-nonstring-2.c
gcc/testsuite/gcc.dg/strlenopt-54.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c
gcc/tree.c
gcc/tree.h