about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2013-11-07 14:45:22 +0000
committerDan Liew <daniel.liew@imperial.ac.uk>2014-02-14 18:29:28 +0000
commit71048bea167794f109b2f0b715b6cc1ba8b6eab9 (patch)
treed610b541607462e9f465ef2ee0e4d257b48491f1 /test
parent207d3aff50cc4bed2adf12819a96fc4254a3d6e6 (diff)
downloadklee-71048bea167794f109b2f0b715b6cc1ba8b6eab9.tar.gz
Fixed overshift of logical right shift by symbolic so that it overshifts
to zero. Test case is included.
Diffstat (limited to 'test')
-rw-r--r--test/Solver/overshift-lright-by-symbolic.kquery26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Solver/overshift-lright-by-symbolic.kquery b/test/Solver/overshift-lright-by-symbolic.kquery
new file mode 100644
index 00000000..7ca6d4d5
--- /dev/null
+++ b/test/Solver/overshift-lright-by-symbolic.kquery
@@ -0,0 +1,26 @@
+# RUN: %kleaver %s > %t
+# RUN: not grep INVALID %t
+
+array shift[4] : w32 -> w8 = symbolic
+# ∀ x. x >= 32 → ( (2 >> x) = 0 )
+# Check we logical right overshift to zero when shifting a constant ALWAYS!
+
+(query [ (Ule  (w32 32) (ReadLSB w32 (w32 0) shift)) ]
+    (Eq
+        (LShr w32 (w32 2)
+            (ReadLSB w32 (w32 0) shift)
+        )
+        (w32 0)
+    ) [ ] [shift] )
+
+# 64-bit version
+# ∀ x. x >= 64 → ( (2 >> x) = 0 )
+array shift64[8] : w32 -> w8 = symbolic
+
+(query [ (Ule  (w64 64) (ReadLSB w64 (w32 0) shift64)) ]
+    (Eq
+        (LShr w64 (w64 2)
+            (ReadLSB w64 (w32 0) shift64)
+        )
+        (w64 0)
+    ) [ ] [shift64] )