This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH]: Fix PR tree-optimization/21407
> I can, in compilation unit A declare a bunch of separate structures that
> I freely use. In compilation unit B I can declare a union of all of
> those structures defined in compilation unit A. Any pointer passing
> accross the boundary between compilation units A and B can this freely
> scramble any variable defined in compilation unit A.
> Thus, our current type based aliasing (and I would argue any type based
> aliasing) that does not assume the worst case for any variable whose
> address may leave the compilation unit is invalid.
I though the guarantee for unions only applied when the access was actually
done through the union type.
ie. the following code has undefined behaviour:
int foo (float f)
p = &v.a;
q = &v.b;
*q = f;