about summary refs log tree commit diff homepage
path: root/lib/Core/Memory.cpp
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2011-11-04 12:25:02 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2011-11-04 12:25:02 +0000
commit255e16af36bc256ec8a9d50245a9943351019487 (patch)
treef5ccddbc4a3ec395847ae3946614e6746213b458 /lib/Core/Memory.cpp
parent0b7e41ad616a9ae717a9b93aa26afabdbc4bf01a (diff)
downloadklee-255e16af36bc256ec8a9d50245a9943351019487.tar.gz
Patch by Tom Bergan that fixes multi-byte reads on big-endian architectures.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@143693 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Core/Memory.cpp')
-rw-r--r--lib/Core/Memory.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Core/Memory.cpp b/lib/Core/Memory.cpp
index 08c0696c..c4228823 100644
--- a/lib/Core/Memory.cpp
+++ b/lib/Core/Memory.cpp
@@ -450,7 +450,7 @@ ref<Expr> ObjectState::read(ref<Expr> offset, Expr::Width width) const {
     ref<Expr> Byte = read8(AddExpr::create(offset, 
                                            ConstantExpr::create(idx, 
                                                                 Expr::Int32)));
-    Res = idx ? ConcatExpr::create(Byte, Res) : Byte;
+    Res = i ? ConcatExpr::create(Byte, Res) : Byte;
   }
 
   return Res;
@@ -468,7 +468,7 @@ ref<Expr> ObjectState::read(unsigned offset, Expr::Width width) const {
   for (unsigned i = 0; i != NumBytes; ++i) {
     unsigned idx = Context::get().isLittleEndian() ? i : (NumBytes - i - 1);
     ref<Expr> Byte = read8(offset + idx);
-    Res = idx ? ConcatExpr::create(Byte, Res) : Byte;
+    Res = i ? ConcatExpr::create(Byte, Res) : Byte;
   }
 
   return Res;