[LLVMbugs] [Bug 7536] New: "comparison of 0 > unsigned expression is always false" is too trigger happy.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 30 16:09:26 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7536

           Summary: "comparison of 0 > unsigned expression is always
                    false" is too trigger happy.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: floitsch at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


When compiling the following program with -Wsign-compare I get the "comparison
of 0 > unsigned expression is always false" warning.
Gcc silently compiles it.

===
static const unsigned int kMax = 0;

int foo() {
  return (kMax > 0);
}
===

=== Warning:
foo.c:4:16: warning: comparison of 0 > unsigned expression is always false
[-Wsign-compare]
  return (kMax > 0);
          ~~~~ ^ ~
1 warning generated.
===

commandline used: clang++ -Wsign-compare -c foo.c

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list