[llvm-bugs] [Bug 27271] New: UBSAN fails to catch shifts by more than 1<<32
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Apr 7 14:58:24 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27271
Bug ID: 27271
Summary: UBSAN fails to catch shifts by more than 1<<32
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: cherepan at mccme.ru
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
UBSAN doesn't warn about this program:
int main(int c, char **v) { 1 << ((long)c << 32); }
Run as `clang -Wno-unused-value -fsanitize=undefined example.c && ./a.out`.
Tested with clang version 3.9.0 (trunk 265708) on x86-64.
gcc6 warns:
example.c:1:31: runtime error: shift exponent 4294967296 is too large for
32-bit type 'int'
Looking at IR, it seems the right operand of the shift is checked only after
it's truncated to 32-bit. This is too late.
--
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/20160407/bf005cbf/attachment.html>
More information about the llvm-bugs
mailing list