Pointer Plus Patch

Zdenek Dvorak rakdver@kam.mff.cuni.cz
Wed Jun 13 22:08:00 GMT 2007


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



More information about the Java-patches mailing list