diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2013-11-07 10:55:12 +0000 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2014-02-14 17:52:10 +0000 |
commit | 458eb00a569445b82decf5687cb4716217ad1ad6 (patch) | |
tree | 9e892ee8609b31201a912b2c021483b5d853db86 /test | |
parent | 3160935d77c3fd6d24be7fddd5c570d6b3944c18 (diff) | |
download | klee-458eb00a569445b82decf5687cb4716217ad1ad6.tar.gz |
Added a test case for testing overshift behaviour of Shl and fixed
a bug in the previous commit where 32-bit width was assumed.
Diffstat (limited to 'test')
-rw-r--r-- | test/Solver/lit.local.cfg | 2 | ||||
-rw-r--r-- | test/Solver/overshift-left-by-symbolic.kquery | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/test/Solver/lit.local.cfg b/test/Solver/lit.local.cfg new file mode 100644 index 00000000..d64daf29 --- /dev/null +++ b/test/Solver/lit.local.cfg @@ -0,0 +1,2 @@ +# Look for .kquery files too +config.suffixes.add('.kquery') diff --git a/test/Solver/overshift-left-by-symbolic.kquery b/test/Solver/overshift-left-by-symbolic.kquery new file mode 100644 index 00000000..9d0d272c --- /dev/null +++ b/test/Solver/overshift-left-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 left overshift to zero when shifting a constant ALWAYS! + +(query [ (Ule (w32 32) (ReadLSB w32 (w32 0) shift)) ] + (Eq + (Shl 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 + (Shl w64 (w64 2) + (ReadLSB w64 (w32 0) shift64) + ) + (w64 0) + ) [ ] [shift64] ) |