[analyzer] Left shifting a negative value is undefined
authorGabor Horvath <xazax.hun@gmail.com>
Mon, 30 Oct 2017 17:06:42 +0000 (17:06 +0000)
committerGabor Horvath <xazax.hun@gmail.com>
Mon, 30 Oct 2017 17:06:42 +0000 (17:06 +0000)
commit4581f7497b41a90595a5a850c6a031b9cf60f50e
tree22bf7ce3e62fa4426b20eb4db3832f925001f0fd
parent0f4c5712b40e83b30e8ce248dcd06a73921cfbbf
[analyzer] Left shifting a negative value is undefined

The analyzer did not return an UndefVal in case a negative value was left
shifted. I also altered the UndefResultChecker to emit a clear warning in this
case.

Differential Revision: https://reviews.llvm.org/D39423

llvm-svn: 316924
clang/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp
clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
clang/test/Analysis/bitwise-ops.c