[llvm-bugs] [Bug 34147] New: -Wtautological-compare / -Wtautological-constant-out-of-range-compare is just broken.
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Aug 10 15:52:10 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34147
Bug ID: 34147
Summary: -Wtautological-compare /
-Wtautological-constant-out-of-range-compare is just
broken.
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: lebedev.ri at gmail.com
CC: llvm-bugs at lists.llvm.org
unsigned char draw[8];
unsigned short v;
int main() {
static_assert(sizeof(unsigned short) == 2, "111");
unsigned short* dest = (unsigned short*)(draw);
if (dest[0] < 0 || dest[0] > 65535)
(void)dest;
// Expected it to complain about both the comparisons.
if (v < 0 || v > 65535)
(void)dest;
// Expected it to complain about both the comparisons.
if (v > 65536)
(void)dest;
// But here it complains. Off by one.
return 0;
};
--
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/20170810/fde470a7/attachment.html>
More information about the llvm-bugs
mailing list