This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/81783] New: -Wtautological-compare could do better
- From: "sirl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Aug 2017 12:50:40 +0000
- Subject: [Bug c/81783] New: -Wtautological-compare could do better
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81783
Bug ID: 81783
Summary: -Wtautological-compare could do better
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sirl at gcc dot gnu.org
Target Milestone: ---
This example code doesn't warn with -Wtautological-compare:
int f(int a)
{
if ((a & 0x10) == 10)
return 1;
return 0;
}
clang warns like this:
Wtautological-compare-1.c:5:17: warning: bitwise comparison always evaluates to
false [-Wtautological-compare]
if ((a & 0x10) == 10)
~~~~~~~~~~~^~~~~