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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, one mistake in the folding is that

  if (TREE_CODE (sub) == POINTER_PLUS_EXPR
      && TREE_CODE (TREE_OPERAND (sub, 1)) == INTEGER_CST)
    {
      tree op00 = TREE_OPERAND (sub, 0);
      tree op01 = TREE_OPERAND (sub, 1);
^^^

this has to be interpreted as signed (but is always sizetype).  I suspect
restricting this to INTEGER_CST min_val and doing the arithmetic with
offset_ints is easiest.  The non-ARRAY_TYPE cases look ok to me.

Reply via email to