This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR32921, prune virtual operands of memory accesses based on TBAA
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
D.1187_3, its value escapes, points-to anything
<retval>_4
so we end up with "anything" for the pointed-to sets.
Richard.