[Bug c/42907] -fstrict-aliasing breaks valid code

steven at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Jan 30 23:19:00 GMT 2010



------- Comment #25 from steven at gcc dot gnu dot org  2010-01-30 23:19 -------
It should be consistent for programs that do not trigger undefined behavior.
The behavior of your program is undefined according to the C standard and
according to GCC.

The alias discussion is just one of th many where different crowds are asking
for different semantics for undefined behavior. But the point of "undefined" is
that, well, the behavior is undefined. So, although it is counterintuitive (and
in fact, quite unfriendly of the compiler) it is not incorrect to have
different program behavior at different optimization levels for a program with
undefined behavior.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42907



More information about the Gcc-bugs mailing list