diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 36f7d2fdfc4..d8bd8f44aa3 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -189,7 +189,10 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { uint64_t Offset = TD->getIndexedOffset(CE->getOperand(0)->getType(), Indexes); - Result.LongVal += Offset; + if (getTargetData().getPointerSize() == 4) + Result.IntVal += Offset; + else + Result.LongVal += Offset; return Result; } case Instruction::Cast: {