re PR tree-optimization/89500 (ICE: tree check: expected integer_cst, have ssa_name...
authorJakub Jelinek <jakub@redhat.com>
Tue, 26 Feb 2019 20:36:29 +0000 (21:36 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 26 Feb 2019 20:36:29 +0000 (21:36 +0100)
commit9bc83f27a703bd7d2393638e0ef93f506ac8bb03
tree7312fc231be96058723ceb7b696e739b968d5eda
parent3d7beb79e0631c7ca8532c497295af03822eeed2
re PR tree-optimization/89500 (ICE: tree check: expected integer_cst, have ssa_name in get_len, at tree.h:5653)

PR tree-optimization/89500
* tree-ssa-strlen.c (stridx_strlenloc): Adjust comment.
(handle_builtin_strlen): Remove noncst_bound variable.  Always
optimize strnlen (x, 0) to 0.  Optimize strnlen (x, cst) to
cst if the first cst bytes starting at x are known to be non-zero,
even if the string is not zero terminated.  Don't try to modify
*si for strnlen.  Update strlen_to_stridx only for strlen or if
we can prove strnlen returns the same value as strlen would.

* gcc.dg/pr89500.c: New test.
* gcc.dg/Wstringop-overflow-10.c: New test.
* gcc.dg/strlenopt-60.c: New test.

From-SVN: r269230
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wstringop-overflow-10.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr89500.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-60.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c