https://llvm.org/bugs/show_bug.cgi?id=24327

            Bug ID: 24327
           Summary: wrong inference for -Wtautological-compare
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: l...@tannerlab.com
                CC: llvmbugs@cs.uiuc.edu
    Classification: Unclassified

the following code

int a;
unsigned int b;
bool foo()
{
    return (a + b) >= 0;
}


compiles with:

warning: comparison of unsigned expression >= 0 is always true
[-Wtautological-compare]
    return (a + b) >= 0;

but, for example, a=-5 b=1, a+b= -4 < 0

i.e signed + unsigned = signed
and not unsigned.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to