https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81292

--- Comment #8 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
Author: rsandifo
Date: Tue Jul  4 11:48:44 2017
New Revision: 249961

URL: https://gcc.gnu.org/viewcvs?rev=249961&root=gcc&view=rev
Log:
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.sandif...@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.

Added:
    trunk/gcc/testsuite/gcc.dg/pr81292-1.c
    trunk/gcc/testsuite/gcc.dg/pr81292-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-strlen.c

Reply via email to