summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2014-01-16 18:02:23 +0000
committerJordan Rose <jordan_rose@apple.com>2014-01-16 18:02:23 +0000
commit2be02a784828c66d0025fe63a8e84751d6531a37 (patch)
tree8f11b2bf927593ab6e4450f5c1a77588d8c00855 /clang/lib/StaticAnalyzer
parentef6fed7c84e7e7a03aa26db4b6d96d91e521419c (diff)
downloadbcm5719-llvm-2be02a784828c66d0025fe63a8e84751d6531a37.tar.gz
bcm5719-llvm-2be02a784828c66d0025fe63a8e84751d6531a37.zip
[analyzer] Shitfing a constant value by its bit width is undefined.
Citation: C++11 [expr.shift]p1 (and the equivalent text in C11). This fixes PR18073, but the right thing to do (as noted in the FIXME) is to have a real checker for too-large shifts. llvm-svn: 199405
Diffstat (limited to 'clang/lib/StaticAnalyzer')
-rw-r--r--clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp b/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
index a6c400f3704..8f93cee6263 100644
--- a/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
@@ -177,7 +177,7 @@ BasicValueFactory::evalAPSInt(BinaryOperator::Opcode Op,
uint64_t Amt = V2.getZExtValue();
- if (Amt > V1.getBitWidth())
+ if (Amt >= V1.getBitWidth())
return NULL;
return &getValue( V1.operator<<( (unsigned) Amt ));
@@ -195,7 +195,7 @@ BasicValueFactory::evalAPSInt(BinaryOperator::Opcode Op,
uint64_t Amt = V2.getZExtValue();
- if (Amt > V1.getBitWidth())
+ if (Amt >= V1.getBitWidth())
return NULL;
return &getValue( V1.operator>>( (unsigned) Amt ));
OpenPOWER on IntegriCloud