https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78772
Jim Wilson <wilson at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilson at gcc dot gnu.org --- Comment #8 from Jim Wilson <wilson at gcc dot gnu.org> --- Looking at the 2011 ISO C standard, section 6.5 Expressions, paragraph 7, says "An object shall have its stored value accessed only by an lvalue expression that has one of the following types:". It then lists compatible types, a qualified compatible type, a signed/unsigned compatible type, a signed/unsigned qualified compatible type, an aggregate/union that contains a compatible type, or a char type. If your code conforms to this rule, then -fstrict-aliasing will not break it. GCC supports type punning via unions. Or you can use -fno-strict-aliasing if you want to use pointer casts for type punning.