------- Comment #1 from pinskia at gcc dot gnu dot org 2008-12-21 01:58 ------- No this is working as designed. GCC does warn about this case. t.c:6: warning: dereferencing type-punned pointer will break strict-aliasing rules
Now in 4.4.0 and above, the same result will happen at -O1 and -O2 because of another optimization that allows for the compiler to remove the alias violation in the IR. *** This bug has been marked as a duplicate of 21920 *** -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |DUPLICATE http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38588