diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2013-11-07 15:21:43 +0000 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2014-02-14 18:29:35 +0000 |
commit | 7759c90744bae5c531f765b2faa2475e13f464fd (patch) | |
tree | ab1d0fbb1c4b767369e2c3774a49ca48de69101c /test/Solver | |
parent | a480b43bf38d4b030d3ceda92549fb721800c026 (diff) | |
download | klee-7759c90744bae5c531f765b2faa2475e13f464fd.tar.gz |
Fixed overshift of arithmetic right shift by symbolic so that it overshifts
to zero. Test case is included.
Diffstat (limited to 'test/Solver')
-rw-r--r-- | test/Solver/overshift-aright-by-symbolic.kquery | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Solver/overshift-aright-by-symbolic.kquery b/test/Solver/overshift-aright-by-symbolic.kquery new file mode 100644 index 00000000..af563ea3 --- /dev/null +++ b/test/Solver/overshift-aright-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 → ( ( ( (signed int)2 ) >> x) = 0 ) +# Check we arithmetic right overshift to zero when shifting a constant ALWAYS! + +(query [ (Ule (w32 32) (ReadLSB w32 (w32 0) shift)) ] + (Eq + (AShr w32 (w32 2) + (ReadLSB w32 (w32 0) shift) + ) + (w32 0) + ) [ ] [shift] ) + +# 64-bit version +# ∀ x. x >= 64 → ( (((signed int) 2) >> x) = 0 ) +array shift64[8] : w32 -> w8 = symbolic + +(query [ (Ule (w64 64) (ReadLSB w64 (w32 0) shift64)) ] + (Eq + (AShr w64 (w64 2) + (ReadLSB w64 (w32 0) shift64) + ) + (w64 0) + ) [ ] [shift64] ) |