[Bug driver/78772] -fstrict-aliasing should turn on Wstrict-aliasing automaticly

ma.jiang at zte dot com.cn gcc-bugzilla@gcc.gnu.org
Tue Dec 13 08:17:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78772

--- Comment #7 from ma.jiang at zte dot com.cn ---
(In reply to Markus Trippelsdorf from comment #5)



Hi Markus,

> These optimizations are not dangerous if you use standard conforming code.
  I think these optimizations  are dangerous because they create wrong binaries
silently, even if we use standard conforming codes. Let us just look at the
"-fstrict-aliasing". This optimization assume "In particular, an object of one
type is assumed never to reside at the same address as an object of a different
type, unless the types
are almost the same". But this restriction *IS NOT* required by the C-standard.
 So codes that conformed to C-standard could also be translated to wrong
binaries by GCC with "-fstrict-aliasing", in silence...
> 
> We could have a discussion if it might be better to enable some -Wall
> warnings
> by default like Clang. But I'm not sure if this gives huge benefits to users.
  I do not know whether it's a good idea to enable warnings such as
Wstrict-aliasing by default. But I believe we should enable these warnings when
corresponding  optimizations are turned on, this do give huge benefits to
users.


More information about the Gcc-bugs mailing list