https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93298
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|DUPLICATE |INVALID --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I'd say it's not a dup but INVALID since you are reading the non-active union member a.m1 after the loop which ends in activating a.m2. GCCs type punning via union doesn't apply because you use pointer accesses as Andrew says. He also points to a related (and valid) bugreport though.