From 51183b4370eb2a081c440b6ff32acc4e5f50890e Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Sun, 29 Oct 2017 22:02:32 +0100 Subject: Fix generation of expressions from constant sequential data --- lib/Core/ExecutorUtil.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') 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(c)) { + // Handle a vector or array: first element has the smallest address, + // the last element the highest std::vector > kids; - for (unsigned i = 0, e = cds->getNumElements(); i != e; ++i) { - ref kid = evalConstant(cds->getElementAsConstant(i), ki); + for (unsigned i = cds->getNumElements(); i != 0; --i) { + ref kid = evalConstant(cds->getElementAsConstant(i - 1), ki); kids.push_back(kid); } ref res = ConcatExpr::createN(kids.size(), kids.data()); -- cgit 1.4.1