]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR tree-optimization/89500
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Feb 2019 20:36:29 +0000 (20:36 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Feb 2019 20:36:29 +0000 (20:36 +0000)
commit3a57b74f6fb4e306ceae8d455a639676197269b4
tree7312fc231be96058723ceb7b696e739b968d5eda
parent72ebb7e861e1ad7bab19aa25276925861ad4c452
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269230 138bc75d-0d04-0410-961f-82ee72b054a4
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