This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/42908] gcc -O2 -Wall doesn't warn about strict aliasing



------- Comment #5 from shana at jitted dot com  2010-02-03 16:13 -------
IMHO, it's not good for strict aliasing warnings on level 2 to be optional and
not included in -Wall by default. As it stands right now, gcc does not warn you
even if it knows your code is 1) breaking the rules, and 2) the assignments
that break the rules are going to be touched by optimizations.

Optimizing away an assignment because that assignment breaks a rule is always a
potential danger. Now I know that the reasoning to not show those warnings by
default is that it can give you false positives, but a false positive in this
case is when you *are* breaking the rules, but an optimization *might* or
*might not* break your code. IMHO, just because your code might not break
doesn't mean the warning is not needed. A developer really needs to know he's
breaking the rules here, regardless of whether things blow up or not.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]