This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: aggregate alias anomaly
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Jeff Sturm <jsturm at one-point dot com>
- Cc: gcc at gcc dot gnu dot org, Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Wed, 18 Feb 2004 21:40:38 -0800
- Subject: Re: aggregate alias anomaly
- References: <Pine.LNX.4.44.0402182348020.12912-100000@ops2.one-point.com>
On Feb 18, 2004, at 21:15, Jeff Sturm wrote:
Given:
struct X {int x;};
struct Y {int y;};
int f(struct X *x, struct Y *y) {
x->x = 0;
y->y = 1;
return x->x;
}
Yes this is a known problem with the current RTL aliasing sets.
To make even matters worse, the following programs is not optimized
either
on any compiler, even the tree-ssa, even after my patch
not to lower &x->x into (int*)(x), but it does work points-to,
with or without the patch:
struct X {int x;};
struct Y {int y;};
int f(struct X *x, struct Y *y) {
int *restrict xx = & x->x;
int *restrict yy = & y->y;
*xx = 0;
*yy = 1;
return *xx;
}
The following code works on RTL on every recent compiler though:
struct X {int x;};
struct Y {int y;};
int f(struct X *__restrict x, struct Y * __restrict y) {
x->x = 0;
y->y = 1;
return x->x;
}
Thanks,
Andrew Pinski