[LLVMbugs] [Bug 24327] New: wrong inference for -Wtautological-compare

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 31 05:58:42 PDT 2015


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: unassignedclangbugs at nondot.org
          Reporter: llvm at tannerlab.com
                CC: llvmbugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150731/22c0042e/attachment.html>


More information about the llvm-bugs mailing list