https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90167
--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> --- But you are not accessing as the union type. You do the access with the type of one of its members. And that is UB. The part of the standard you quote is about things like union a_union f(double *p) { return *(union a_union *)p; }