This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: fold: &a[i1] + c * i2 -> &a[i1 + i2] messing up types
Hello,
> > > If you prefer removing the type argument that would be fine, too.
> >
> > this might be a good idea, yes.
>
> Actually, in
>
> step = array_ref_element_size (ref);
>
> if (TREE_CODE (step) != INTEGER_CST)
> continue;
>
> itype = TREE_TYPE (step);
>
> /* If the type sizes do not match, we might run into problems
> when one of them would overflow. */
> if (TYPE_PRECISION (itype) != TYPE_PRECISION (type))
> continue;
>
> if (!operand_equal_p (step, fold_convert (itype, s), 0))
> continue;
>
> do you really mean to compare TYPE_PRECISION (itype) and TYPE_PRECISION
> (type)? I think type should refer to TREE_TYPE (s) here, not to
> TREE_TYPE (addr), no?
they have the same size.
Zdenek