This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/17534] New: gcc fails to diagnose suspect expressions that have incompatible bit masks
- From: "trt at acm dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Sep 2004 14:53:10 -0000
- Subject: [Bug middle-end/17534] New: gcc fails to diagnose suspect expressions that have incompatible bit masks
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The expressions (z & 2) == 4 and (z | 2) == 4 are always false. When these
appear in programs it is almost always unintended, but gcc fails to warn the user.
An example undiagnosed mistake appears in gcc/gcc/java/parse.y near line 1154
/* Can't have a static initializer in an innerclass */
if ($1 | ACC_STATIC &&
...
The '|' is unlikely to have been intended.
I added a warning for this to "my" gcc years ago, and it works well. I recently
got this warning added to the Java "findbugs" tool
http://findbugs.sourceforge.net/bugDescriptions.html (That took less than a
week, in stark contrast to my experiences with gcc).
I have a patch, but this web form lacks a way to supply it.
--
Summary: gcc fails to diagnose suspect expressions that have
incompatible bit masks
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: trt at acm dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17534