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/43772] New: Errant -Wlogical-op warning when testing limits


/* 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


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