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: unassignedclangb...@nondot.org
Reporter: tbl...@icloud.com
CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
richard-l...@metafoo.co.uk
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
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs