This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: IMA vs tree-ssa
Richard Henderson <rth@redhat.com> writes:
> On Thu, Feb 26, 2004 at 02:20:09PM -0800, Dale Johannesen wrote:
> > There are several places where tree-ssa does type comparison by
> > comparing TYPE_MAIN_VARIANT() for equality. This doesn't work with
> > IMA, and leads to several different ICEs in various SPECmarks (you
> > can probably figure out which one the example came from :)
>
> This is a bug in IMA. When unifying the types, you should either
> replace all of them or make all copies be variants. Clearly the
> later is much easier than the former.
As I commented, will this really work?
Consider:
a.c:
struct bar {
int x;
};
extern void foo (struct bar *bp);
// call foo()
b.c:
struct not_bar {
int x;
};
void foo (struct not_bar *bp) {
...
}
This is valid C89.
Also, consider:
a.c:
union x_u {
int i[2];
double d;
};
union x_u x_u_i = { 0x1234, 0x5678 };
b.c:
extern union {
double d;
int i[2];
} x_u_i;
// use x_u_i
which is also valid in C89. The rules got tightened significantly in
C99, but even then you can have one anonymous structure and another
which has a tag.
In addition, structure compatilibity between modules is not
transitive, even in C99. For instance,
struct { int x; }
is compatible with both
struct x_1 { int x; }
and
struct x_2 { int x; }
but x_1 and x_2 are not compatible with each other.
The relevant paragraphs in the standards are 6.1.2.6 para 1 in C89,
and 6.2.7 para 1 in C99; note that the paragraphs are quite different,
this is one of the more significant changes between C89 and C99.
If it does work, I agree this is the best solution.
--
- Geoffrey Keating <geoffk@geoffk.org>