https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115432
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- struct file_output_stream { union { void *voidp; int fd; } data; const output_stream_vtbl* vtbl; }; struct output_stream { void* data; const output_stream_vtbl* vtbl; }; those are two unrelated types. Doing ((file_output_stream *)p)->vtbl = x; ... = ((output_stream *)p)->vtbl; is invoking undefined behavior (unless -fno-strict-aliasing).