about summary refs log tree commit diff homepage
path: root/lib/Solver/MetaSMTBuilder.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Solver/MetaSMTBuilder.h')
-rw-r--r--lib/Solver/MetaSMTBuilder.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Solver/MetaSMTBuilder.h b/lib/Solver/MetaSMTBuilder.h
index b5c99907..458c55ba 100644
--- a/lib/Solver/MetaSMTBuilder.h
+++ b/lib/Solver/MetaSMTBuilder.h
@@ -499,6 +499,11 @@ typename SolverContext::result_type MetaSMTBuilder<SolverContext>::bvVarLeftShif
                                                     bvLeftShift(expr, width, i, shiftBits),
                                                     res));
     }
+    
+    // If overshifting, shift to zero    
+    res = evaluate(_solver, metaSMT::logic::Ite(bvult(shift, bvConst32(shiftBits, width)),
+                                                res,
+                                                bvZero(width)));                                                
 
     return(res);
 }
@@ -521,6 +526,11 @@ typename SolverContext::result_type MetaSMTBuilder<SolverContext>::bvVarRightShi
                                                     res));
          // ToDo Reconsider widht to provide to bvRightShift
     }
+    
+    // If overshifting, shift to zero
+    res = evaluate(_solver, metaSMT::logic::Ite(bvult(shift, bvConst32(shiftBits, width)),
+                                                res,
+                                                bvZero(width)));                                                
 
     return(res);
 }
@@ -548,6 +558,11 @@ typename SolverContext::result_type MetaSMTBuilder<SolverContext>::bvVarArithRig
                                                     constructAShrByConstant(expr, width, i, signedBool, shiftBits),
                                                     res));
     }
+    
+    // If overshifting, shift to zero
+    res = evaluate(_solver, metaSMT::logic::Ite(bvult(shift, bvConst32(shiftBits, width)),
+                                                res,
+                                                bvZero(width)));      
 
     return(res);
 }