This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/43772] New: Errant -Wlogical-op warning when testing limits
- From: "P at draigBrady dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Apr 2010 21:43:57 -0000
- Subject: [Bug c/43772] New: Errant -Wlogical-op warning when testing limits
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
/* compile with: gcc -Werror -Wlogical-op */
#include <limits.h>
# define BOT INT_MIN
# define TOP INT_MAX
int main(void)
{
int i=42;
i = (i > BOT && i < TOP); //OK
i = (i >= BOT+1 && i <= TOP-1); //OK
i = (i >= BOT && i <= TOP); //Oops!
}
--
Summary: Errant -Wlogical-op warning when testing limits
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: P at draigBrady dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772