https://bugs.llvm.org/show_bug.cgi?id=40234
Bug ID: 40234
Summary: clang should warn about unsigned comparison with zero
with -Wall -Wextra
Product: clang
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Given this function:
int f(unsigned x) {
return x < 0;
}
GCC gives the following warning with -Wextra:
<source>: In function 'int f(unsigned int)':
<source>:2:14: warning: comparison of unsigned expression < 0 is always false
[-Wtype-limits]
return x < 0;
~~^~~
Clang doesn't warn at all, even with -Wall -Wextra. You need to specify
-Wtautological-constant-in-range-compare, which is really hard to figure out.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs