This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: aggregate alias anomaly



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]