This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Pointer Plus Patch
- From: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- To: Diego Novillo <dnovillo at google dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org, Fortran List <fortran at gcc dot gnu dot org>
- Date: Wed, 13 Jun 2007 22:25:27 +0200
- Subject: Re: Pointer Plus Patch
- References: <4670040B.9090605@google.com>
Hello,
> > *************** number_of_iterations_le (tree type, affi
> > *** 1062,1067 ****
> > --- 1069,1077 ----
> > bounds *bnds)
> > {
> > tree assumption;
> > + tree type1 = type;
> > + if (POINTER_TYPE_P (type))
> > + type1 = sizetype;
>
> It worries me a little bit that we are straight out using sizetype here.
> Shouldn't we at least assert that type1 and type are compatible? This
> happens regularly in this file. This needs at least a comment
> clarifying why it's safe to do this in the case of pointers.
because the type of rhs of pointer_plus (and consequently the type of
the step of pointer-type induction variables) is sizetype.
> > to_add = chrec_convert (type, to_add, at_stmt);
> > ! right = chrec_convert (type, right, at_stmt);
> > ! right = chrec_fold_plus (type, right, to_add);
> > return build_polynomial_chrec (var, left, right);
> > }
> > else
> > --- 665,672 ----
> > }
> >
> > to_add = chrec_convert (type, to_add, at_stmt);
> > ! right = chrec_convert_rhs (type, right, at_stmt);
> > ! right = chrec_fold_plus (chrec_type (right), right, to_add);
>
> Hmm, why change 'type' to 'chrec_type (right)' on the second call to
> chrec_fold_plus? An unrelated bug fix or did it pop up because of ptr_plus?
Because of ptr_plus -- type and chrec_type (right) are now different for
pointer-type induction variables.
Zdenek