diff options
author | hutoTUM <hutoTUM@users.noreply.github.com> | 2016-08-08 09:26:30 +0200 |
---|---|---|
committer | hutoTUM <hutoTUM@users.noreply.github.com> | 2016-08-08 12:07:46 +0200 |
commit | ad866e123b6be8a160ecb87249884cc3dfc3a349 (patch) | |
tree | 5352d76b9c0a1647520c0bad807df5ea1ff331f7 /lib | |
parent | 039e8c5ee8b5e23e6031e241ddf202d2a12db3b7 (diff) | |
download | klee-ad866e123b6be8a160ecb87249884cc3dfc3a349.tar.gz |
Fix for klee_get_obj_size() crashing on 64-bit, resolves #446
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Core/SpecialFunctionHandler.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp index caec5e39..542d7f5b 100644 --- a/lib/Core/SpecialFunctionHandler.cpp +++ b/lib/Core/SpecialFunctionHandler.cpp @@ -30,6 +30,14 @@ #endif #include "llvm/ADT/Twine.h" +#if LLVM_VERSION_CODE <= LLVM_VERSION(3, 1) +#include "llvm/Target/TargetData.h" +#elif LLVM_VERSION_CODE <= LLVM_VERSION(3, 2) +#include "llvm/DataLayout.h" +#else +#include "llvm/IR/DataLayout.h" +#endif + #include <errno.h> using namespace llvm; @@ -538,8 +546,11 @@ void SpecialFunctionHandler::handleGetObjSize(ExecutionState &state, executor.resolveExact(state, arguments[0], rl, "klee_get_obj_size"); for (Executor::ExactResolutionList::iterator it = rl.begin(), ie = rl.end(); it != ie; ++it) { - executor.bindLocal(target, *it->second, - ConstantExpr::create(it->first.first->size, Expr::Int32)); + executor.bindLocal( + target, *it->second, + ConstantExpr::create(it->first.first->size, + executor.kmodule->targetData->getTypeSizeInBits( + target->inst->getType()))); } } |