about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorPaul Marinescu <paul.marinescu@imperial.ac.uk>2014-12-08 01:07:52 +0000
committerPaul Marinescu <paul.marinescu@imperial.ac.uk>2014-12-08 19:43:47 +0000
commitbc7ddafc93f1b30fa39e7f47f62b41ae3ed6a07b (patch)
treea3fda0264f183fe73fa3b31e01708c05063d68ab /lib
parentf481b1e1503207443fc6100c0be489d58f12d787 (diff)
downloadklee-bc7ddafc93f1b30fa39e7f47f62b41ae3ed6a07b.tar.gz
Fix overshift check
Shifting by bitwidth-1 is valid
Diffstat (limited to 'lib')
-rw-r--r--lib/Solver/MetaSMTBuilder.h2
-rw-r--r--lib/Solver/STPBuilder.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/Solver/MetaSMTBuilder.h b/lib/Solver/MetaSMTBuilder.h
index b5c99907..92b26926 100644
--- a/lib/Solver/MetaSMTBuilder.h
+++ b/lib/Solver/MetaSMTBuilder.h
@@ -284,7 +284,7 @@ typename SolverContext::result_type MetaSMTBuilder<SolverContext>::constructAShr
     if (shift == 0) {
         res = expr;
     }
-    else if (shift >= width - 1) {
+    else if (shift >= width) {
         res = evaluate(_solver, metaSMT::logic::Ite(isSigned, bvMinusOne(width), bvZero(width)));
     }
     else {
diff --git a/lib/Solver/STPBuilder.cpp b/lib/Solver/STPBuilder.cpp
index 34ce0ede..6d7dd8b7 100644
--- a/lib/Solver/STPBuilder.cpp
+++ b/lib/Solver/STPBuilder.cpp
@@ -283,7 +283,7 @@ ExprHandle STPBuilder::constructAShrByConstant(ExprHandle expr,
 
   if (shift==0) {
     return expr;
-  } else if (shift>=width-1) {
+  } else if (shift>=width) {
     return bvZero(width); // Overshift to zero
   } else {
     return vc_iteExpr(vc,