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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The simplest fix might be:
--- gcc/tree-ssa-strlen.c.jj    2019-01-18 00:33:19.466003372 +0100
+++ gcc/tree-ssa-strlen.c       2019-02-25 21:59:18.743419101 +0100
@@ -1302,6 +1302,7 @@ handle_builtin_strlen (gimple_stmt_itera
                = fold_build2_loc (loc, MIN_EXPR, TREE_TYPE (rhs), rhs, bound);

              noncst_bound = (TREE_CODE (new_rhs) != INTEGER_CST
+                             || TREE_CODE (rhs) != INTEGER_CST
                              || tree_int_cst_lt (new_rhs, rhs));

              rhs = new_rhs;

The problem is that even when rhs is not INTEGER_CST, when bound is
size_zero_node, then new_rhs is size_zero_node too, but we can't really use
tree_int_cst_lt in that case (nor know anything about the string length).

But, I think we don't want to stay at that, noncst_bound seems to be really
misnamed, but furthermore, I fail to see when it is ever useful to record
something (or when it actually would record anything, because it doesn't it
si->nonzero_chars is INTEGER_CST.

Reply via email to