diff options
author | Martin Sebor <msebor@redhat.com> | 2019-10-28 23:53:08 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2019-10-28 17:53:08 -0600 |
commit | efe646c468656959236de0fbe2224561873fb189 (patch) | |
tree | dbf3a51d2e92be9f3a8a1d7b0358423b3a5b815a /gcc/tree-ssa-strlen.c | |
parent | 02c4de7631a177ea44149332aa1294a60ed9adad (diff) | |
download | gcc-efe646c468656959236de0fbe2224561873fb189.zip gcc-efe646c468656959236de0fbe2224561873fb189.tar.gz gcc-efe646c468656959236de0fbe2224561873fb189.tar.bz2 |
tree-ssa-strlen.c (get_addr_stridx): Add argument and use it.
gcc/ChangeLog:
* tree-ssa-strlen.c (get_addr_stridx): Add argument and use it.
(handle_store): Pass argument to get_addr_stridx.
gcc/testsuite/ChangeLog:
* gcc.dg/strlenopt-89.c: New test.
* gcc.dg/strlenopt-90.c: New test.
* gcc.dg/Wstringop-overflow-20.c: New test.
From-SVN: r277546
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r-- | gcc/tree-ssa-strlen.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 476bcf6..50cc442 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -281,7 +281,8 @@ get_next_strinfo (strinfo *si) *OFFSET_OUT. */ static int -get_addr_stridx (tree exp, tree ptr, unsigned HOST_WIDE_INT *offset_out) +get_addr_stridx (tree exp, tree ptr, unsigned HOST_WIDE_INT *offset_out, + const vr_values *rvals = NULL) { HOST_WIDE_INT off; struct stridxlist *list, *last = NULL; @@ -319,7 +320,7 @@ get_addr_stridx (tree exp, tree ptr, unsigned HOST_WIDE_INT *offset_out) unsigned HOST_WIDE_INT rel_off = (unsigned HOST_WIDE_INT) off - last->offset; strinfo *si = get_strinfo (last->idx); - if (si && compare_nonzero_chars (si, rel_off) >= 0) + if (si && compare_nonzero_chars (si, rel_off, rvals) >= 0) { if (offset_out) { @@ -4328,7 +4329,7 @@ handle_store (gimple_stmt_iterator *gsi, bool *zero_write, const vr_values *rval } else { - idx = get_addr_stridx (lhs, NULL_TREE, &offset); + idx = get_addr_stridx (lhs, NULL_TREE, &offset, rvals); if (idx > 0) si = get_strinfo (idx); } |