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: unassignedclangb...@nondot.org Reporter: chere...@mccme.ru CC: llvm-bugs@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.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs