aggregate aliasing losage
Richard Henderson
rth@cygnus.com
Thu Jun 1 15:55:00 GMT 2000
On Thu, Jun 01, 2000 at 03:42:55PM -0400, Richard Kenner wrote:
> I'm wondering if this means that in Fortran, the alias set of an array
> has to be the same as the alias set of its component.
I don't think this issue is limited to Fortran. Consider
struct s1 { double d; };
struct s2 { double d; };
double f(struct s1 *a, struct s2 *b)
{
a->d = 1.0;
return b->d + 1.0;
}
int main()
{
struct s1 a;
a.d = 0.0;
if (f (&a, (struct s2 *)&a) != 2.0)
abort ();
return 0;
}
The way I read c99's 6.5/7
] 7 An object shall have its stored value accessed only by an lvalue
] expression that has one of the following types:
] - a type compatible with the effective type of the object,
the type of `b->d' is certainly compatible with the type of `a->d',
which is the object being referenced.
It is true that the structures themselves are not compatible, due to
having different structure tags, but I don't necessarily agree that's
relevant.
r~
More information about the Gcc-patches
mailing list