https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66265
Bug ID: 66265 Summary: strict aliasing with O2 fails to generate correct code and gives no warnings Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gougolith at gmail dot com Target Milestone: --- Created attachment 35607 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35607&action=edit Sample code that exhibits the issue. This may be a genuine bug since the issue manifests itself depending on the way the memory allocation is done. Clearly the pointers are all the same type. I turned on the following flags to generate the code: gcc -Wall -O2 -pedantic -Wextra -Wall Generates no warnings of any kind but the program is broken. gcc -Wall -O2 -pedantic -Wextra -Wall -fno-strict-aliasing Generates no warnings and correct program. I'm sure this is a strict-aliasing issue but it makes no sense why no warning is issued if that's the case?