[PTR-PLUS] Add/fix documentation for POINTER_PLUS_EXPR

Richard Guenther richard.guenther@gmail.com
Mon May 7 22:38:00 GMT 2007


On 5/8/07, Andrew Pinski <pinskia@gmail.com> wrote:
> On 5/7/07, Richard Guenther <richard.guenther@gmail.com> wrote:
> > No, I don't see an easy way around this problem.  But won't using unsigned
> > sizetype cause some problems with number-of-iterations analysis as well?
> >
> > But of course not being able to fold
> >
> >     if (p (pplus) 4 > p (pplus) -4)
> >
> > doesn't look like a better problem to solve.
>
> Why do you think we still cannot fold this?
> We do already on the branch:
> apinski@debian:~/src/gcc-fsf/pointerplusexpr$ cat t.c
> int f(int *a)
> {
>   return (a+4) > (a+(-4));
> }

I was sure we still can.  Just from the documentation of
POINTER_PLUS_EXPR this isn't clear.

Also it just occured to me:

  int *p;
  for (int i = -n; i < n; ++i)
    {
       t1 = (unsigned sizetype)i;
       t2 = 4 * t1;
       p2 = p (pplus) t2;
       use(*p2);
    }

does SCEV handle this (wrapping in unsigned) case?

Richard.



More information about the Gcc-patches mailing list