[PATCH] Fix PR32921, prune virtual operands of memory accesses based on TBAA

Daniel Berlin dberlin@dberlin.org
Mon Oct 22 01:34:00 GMT 2007


On 10/21/07, Richard Guenther <rguenther@suse.de> wrote:
> On Sun, 21 Oct 2007, Daniel Berlin wrote:
>
> > > conservative.  Indeed, once Danny switched PTA to "real PTA", for
> > >
> > > struct foo {
> > >   int a;
> > >   double x;
> > > } m;
> > >
> > > int *a = &m.x;
> > >
> > > PTA says that a points to m(!)
> >
> > ?
> > It should say it points to m.x in this case.
> >
> > The only cases where it wil get different answers from where it used
> > to is when you do things like:
> >
> >
> > struct foo *a = &m;
> >
> > Before it would say a points to m and  m.x
> > Now it just says it points to m.a, and we rely on the offset and size
> > of the access at operands time to figure out where it is accessing
> > from the pointed-to pointer.
>
> Ok, I wasn't quite right.  But for (arithmetic to force values into temps)
>
> struct foo {
>   int a;
>   double b;
> } m;
> long *test2(void)
> {
>   void *p = &m.b;
>   return p-8;
> }
>
> Constraints:
>
> m = &ANYTHING
> m.b = &ANYTHING
> p.1_2 = &m.b
> D.1187_3 = p.1_2 + -64
> D.1185_4 = D.1187_3
>
> Points-to sets
>
> p.1_2 = { m.b }
> m = { ANYTHING }
> m.b = { ANYTHING }
> D.1187_3 = { }
> D.1185_4 = same as D.1187_3
>
> Pointed-to sets for pointers in test2
>
> p.1_2, points-to anything

This is wrong.
I wonder why it says this.

Something in find_what_p_points_to is going wrong.

> D.1187_3, its value escapes, points-to anything

This is probably due to a bug that was papered over very early in the
tree-ssa days.  That is, we consider empty points-to sets to point to
anything.

If we are still doing that, this is why it thinks D.1187_3 points to anything.
> <retval>_4
>



More information about the Gcc-patches mailing list