about summary refs log tree commit diff homepage
path: root/lib/Core/ExecutorUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Core/ExecutorUtil.cpp')
-rw-r--r--lib/Core/ExecutorUtil.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp
index 53f4c5b8..4f51ecb6 100644
--- a/lib/Core/ExecutorUtil.cpp
+++ b/lib/Core/ExecutorUtil.cpp
@@ -58,9 +58,11 @@ namespace klee {
         return ConstantExpr::create(0, getWidthForLLVMType(c->getType()));
       } else if (const ConstantDataSequential *cds =
                  dyn_cast<ConstantDataSequential>(c)) {
+        // Handle a vector or array: first element has the smallest address,
+        // the last element the highest
         std::vector<ref<Expr> > kids;
-        for (unsigned i = 0, e = cds->getNumElements(); i != e; ++i) {
-          ref<Expr> kid = evalConstant(cds->getElementAsConstant(i), ki);
+        for (unsigned i = cds->getNumElements(); i != 0; --i) {
+          ref<Expr> kid = evalConstant(cds->getElementAsConstant(i - 1), ki);
           kids.push_back(kid);
         }
         ref<Expr> res = ConcatExpr::createN(kids.size(), kids.data());