PR 81292: ICE on related strlens after r249880
commite6f1ccb63de3e06e909d2762342fb7db52026f4a
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Jul 2017 11:48:44 +0000 (4 11:48 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 4 Jul 2017 11:48:44 +0000 (4 11:48 +0000)
tree12020e076b3b67d0a74a4361ec63a0c71c1b88e3
parentccaa30f1d826254b329c05e070f05652868d761c
PR 81292: ICE on related strlens after r249880

r249880 installed the result of a strlen in a strinfo if the strinfo
wasn't previously a full string.  But as Jakub says in the PR comments,
we can't just do that in isolation, because there are no vdefs on the
call that would invalidate any related strinfos.

This patch updates the related strinfos if the adjustment is simple and
invalidates them otherwise.  As elsewhere, we treat adjustments of the
form strlen +/- INTEGER_CST as simple but anything else as too complex.

2017-07-04  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
PR tree-optimization/81292
* tree-ssa-strlen.c (handle_builtin_strlen): When setting
full_string_p, also call adjust_related_strinfos if the adjustment
is simple, otherwise invalidate related strinfos.

gcc/testsuite/
PR tree-optimization/81292
* gcc.dg/pr81292-1.c: New test.
* gcc.dg/pr81292-2.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249961 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr81292-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr81292-2.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c