This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
aggregate alias anomaly
- From: Jeff Sturm <jsturm at one-point dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 19 Feb 2004 00:15:27 -0500 (EST)
- Subject: aggregate alias anomaly
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;
}
gcc -O2 -fomit-frame-pointer yields:
f:
movl 4(%esp), %eax
movl 8(%esp), %edx
movl $0, (%eax)
movl $1, (%edx)
movl (%eax), %eax
ret
for every released compiler I tried, plus mainline. Note the useless load
of x->x, given that x and y cannot possibly have conflicting alias sets.
Currently, tree-ssa fares better:
f:
movl 4(%esp), %eax
movl $0, (%eax)
movl 8(%esp), %eax
movl $1, (%eax)
xorl %eax, %eax
ret
In both cases the alias sets appear correct, but mainline tests the alias
sets of `struct X' vs. `int' which must conflict, since the former is a
superset of the latter.
Since I'm no expert in RTL I'll ask: is this a known problem? Is it hard
to fix for some reason? (For tree-ssa I read the description of
may_alias_p, and it makes sense to me, whereas I'm lost in flow.c.)
As far as I can see, alias analysis for Java is useless on mainline.
Jeff