https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112972
Stephan Stiller <stephan.stiller at outlook dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID |--- --- Comment #2 from Stephan Stiller <stephan.stiller at outlook dot com> --- I disagree; the documentation overall is contradictory with respect to whether reading from a different member with the same type is also considered "type punning". Given the example of union datum p, it wouldn't make sense for any compiler to not produce code with the intended effect for something like the following: p.height = 3.4; double d = p.weight; However, the point is that this is not explicitly documented for the case of different members having identical types. For the example from the GCC webpage, if union foo were replaced by union datum, it would be unclear what the "equivalence" would be. (The choice of latitute/longitude/height/weight as the designated member of type double wouldn't matter in practice, but again, this needs to be said explicitly.)