https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101641
--- Comment #5 from Martin Uecker <muecker at gwdg dot de> --- (In reply to Richard Biener from comment #3) > > What we know from the union read is that the dynamic type is either the > union type (so the read can pun) or the dynamic type is the union member > type (then the read cannot pun). 6.5/7 allows accesses using > "an aggregate or union type that includes [a type compatible with the > effective > type of the object]". Though the 'aggregate' case appears quite odd to me, > does it really allow 'int i; struct { float f; int i; } *p = &i; float x = > p->f;'? I do not think this is meant to work as the read is using an lvalue of type float and that is not covered by the rules. I believe that the aggregate case is meant for the case where sub objects are modified as part of struct/union assignment (i.e. when the lvalue used for the access is of struct/union type). But the rules could be interpreted to allow: int i; struct { float f; int i; } *p = &i; int j = p->i; which I think should not be allowed.