Another example + possible fix (two WidthMinusOne, one per (possibly
different) bitwidth): (not fully tested)
int f() {
return 0 << 0L;
}
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 40d949dece..5c9055d49a 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/Cod
Hi Vedant,
This commit has caused a compiler crash in our stage 2 green dragon
ASAN+Ubsan bot (
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_build/). I have
reverted it in r293475. The following example reproduces the crash with
-fsanitize=undefined :
typedef unsigned long long u
Author: vedantk
Date: Fri Jan 27 17:02:44 2017
New Revision: 293343
URL: http://llvm.org/viewvc/llvm-project?rev=293343&view=rev
Log:
[ubsan] Sanity-check shift amounts before truncation (fixes PR27271)
Ubsan does not report UB shifts in some cases where the shift exponent
needs to be truncated t