[llvm-bugs] [Bug 37771] New: Incorrect clang warning -Wconstant-conversion on unsigned types
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jun 11 11:01:30 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37771
Bug ID: 37771
Summary: Incorrect clang warning -Wconstant-conversion on
unsigned types
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: manojgupta at google.com
CC: llvm-bugs at lists.llvm.org, rtrieu at google.com
Found when building Linux kernel 4.14 with clang:
(https://bugs.chromium.org/p/chromium/issues/detail?id=849780).
Reduced test cases:
unsigned char test_char(void)
{
const unsigned char w = 128;
return ~w;
}
../build/char_warn.c:5:10: error: implicit conversion from 'int' to 'unsigned
char' changes value from -129 to 127
[-Werror,-Wconstant-conversion]
return ~w;
unsigned short test_short(void)
{
const unsigned short w = 0x8000;
return ~w;
}
../build/short_warn.c:5:10: error: implicit conversion from 'int' to 'unsigned
short' changes value from -32769 to 32767
[-Werror,-Wconstant-conversion]
return ~w;
--
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/20180611/34a2f4ea/attachment.html>
More information about the llvm-bugs
mailing list