about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-29 04:13:37 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-29 04:13:37 +0000
commit8601612227e50352eecba41168252eee1e9c0410 (patch)
tree21e62bd54d59f615b1ae1bb32cffba329a918176 /lib
parent48e88fc93c95a84c53f7250fdc698f37d4623250 (diff)
downloadklee-8601612227e50352eecba41168252eee1e9c0410.tar.gz
Multiply for alloca & malloca instructions may need to coerce index expression
to target pointer width.


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@77428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/Executor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index a8056b8b..5118fac2 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -1777,9 +1777,9 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
       kmodule->targetData->getTypeStoreSize(ai->getAllocatedType());
     ref<Expr> size = Expr::createPointer(elementSize);
     if (ai->isArrayAllocation()) {
-      // XXX coerce?
       ref<Expr> count = eval(ki, 0, state).value;
-      size = MulExpr::create(count, size);
+      count = Expr::createCoerceToPointerType(count);
+      size = MulExpr::create(size, count);
     }
     bool isLocal = i->getOpcode()==Instruction::Alloca;
     executeAlloc(state, size, isLocal, ki);