From 458eb00a569445b82decf5687cb4716217ad1ad6 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Thu, 7 Nov 2013 10:55:12 +0000 Subject: Added a test case for testing overshift behaviour of Shl and fixed a bug in the previous commit where 32-bit width was assumed. --- lib/Solver/STPBuilder.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/Solver') diff --git a/lib/Solver/STPBuilder.cpp b/lib/Solver/STPBuilder.cpp index 6cb7dd38..cdc30f85 100644 --- a/lib/Solver/STPBuilder.cpp +++ b/lib/Solver/STPBuilder.cpp @@ -223,8 +223,10 @@ ExprHandle STPBuilder::bvVarLeftShift(ExprHandle expr, ExprHandle amount, unsign bvLeftShift(expr, i, shiftBits), res); } + + // If overshifting, shift to zero res = vc_iteExpr(vc, - vc_bvLtExpr(vc, amount, bvConst32(32, width)), + vc_bvLtExpr(vc, amount, bvConst32(width, width)), res, bvZero(width)); return res; -- cgit 1.4.1