[Bug tree-optimization/90989] incorrrect strlen result after second strcpy into the same destination

2019-06-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90989

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #2 from Martin Sebor  ---
Patch: https://gcc.gnu.org/ml/gcc-patches/2019-06/msg01506.html

[Bug tree-optimization/90989] incorrrect strlen result after second strcpy into the same destination

2019-06-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90989

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
  Known to work||8.3.0
   Keywords||wrong-code
   Last reconfirmed||2019-06-24
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
 Blocks||83819
 Ever confirmed|0   |1
  Known to fail||10.0, 9.1.0

--- Comment #1 from Martin Sebor  ---
The bug was introduced by my r263018:   

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.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83819
[Bug 83819] [meta-bug] missing strlen optimizations