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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Comment on attachment 53362
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53362
gcc13-pr106449.patch

> +               t = fold_convert (sizetype, fd->loops[i + 1].n1);
> +               t = fold_build_pointer_plus (t2, t);

I think the first line is not needed, given that fold_build_pointer_plus_loc
has:

  return fold_build2_loc (loc, POINTER_PLUS_EXPR, TREE_TYPE (ptr),
                          ptr, convert_to_ptrofftype_loc (loc, off));

and the convert_to_ptrofftype_loc does:

  if (ptrofftype_p (TREE_TYPE (off)))
    return off;
  return fold_convert_loc (loc, sizetype, off);

where the last line matches your first line. Hence, just calling

                  t = fold_build_pointer_plus (t2, fd->loops[i + 1].n1);

should gives the same result and is more compact (avoids a line and a
2-character indent).

Reply via email to