diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-06-14 06:52:04 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-06-14 06:52:04 +0000 |
commit | 363d50af298495a76c851a244ccb06972c1febb9 (patch) | |
tree | 4e72a414c554b29ec6b337a90c3043b35b5887ac /lib/Core/Memory.cpp | |
parent | 171810d97c206c090ff588729f1ee16f9d47cbfb (diff) | |
download | klee-363d50af298495a76c851a244ccb06972c1febb9.tar.gz |
More ConstantExpr tweaks.
- We can safely assume for now that array indices are within 32-bits (we will enforce this even on 64-bit targets). - We can also safely assume that address fit in 64-bits. - Always look up function pointers using 64-bits. - Protect a few other places by explicit checks that the type is <= 64-bits, when we can fallback to a safe path. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73328 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Core/Memory.cpp')
-rw-r--r-- | lib/Core/Memory.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Core/Memory.cpp b/lib/Core/Memory.cpp index 49198df8..05c226d3 100644 --- a/lib/Core/Memory.cpp +++ b/lib/Core/Memory.cpp @@ -430,7 +430,7 @@ void ObjectState::write8(ref<Expr> offset, ref<Expr> value) { ref<Expr> ObjectState::read(ref<Expr> offset, Expr::Width width) const { if (ConstantExpr *CE = dyn_cast<ConstantExpr>(offset)) { - return read((unsigned) CE->getConstantValue(), width); + return read(CE->getZExtValue(32), width); } else { switch (width) { default: assert(0 && "invalid type"); @@ -619,7 +619,7 @@ ref<Expr> ObjectState::read64(ref<Expr> offset) const { void ObjectState::write(ref<Expr> offset, ref<Expr> value) { Expr::Width w = value->getWidth(); if (ConstantExpr *CE = dyn_cast<ConstantExpr>(offset)) { - write(CE->getConstantValue(), value); + write(CE->getZExtValue(32), value); } else { switch(w) { case Expr::Bool: write1(offset, value); break; @@ -635,7 +635,7 @@ void ObjectState::write(ref<Expr> offset, ref<Expr> value) { void ObjectState::write(unsigned offset, ref<Expr> value) { Expr::Width w = value->getWidth(); if (ConstantExpr *CE = dyn_cast<ConstantExpr>(value)) { - uint64_t val = CE->getConstantValue(); + uint64_t val = CE->getZExtValue(); switch(w) { case Expr::Bool: case Expr::Int8: write8(offset, val); break; |