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,
> > however the cast should be done using fold_convert:
> >
> > tem = try_move_mult_to_index (TREE_TYPE (arg0), PLUS_EXPR, arg0, arg1);
> > if (tem)
> > return fold (fold_convert (type, tem));
>
> Actually, shouldn't that be
> return fold_convert (type, fold (tem));
> instead?
> Calling fold on fold_convert result is pointless, as it is already folded.
> But if the arg passed to fold_convert is not already folded, we might miss
> some simplifications.
yes, sure.
Zdenek