diff options
author | MartinNowack <martin.nowack@gmail.com> | 2016-08-08 22:01:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-08 22:01:00 +0200 |
commit | 74d88a5e0d6020fc262c166e42b8acdc335b4999 (patch) | |
tree | f6bbef19c49dc0c5b7484fcc563b4a21f2185234 /lib/Core/SpecialFunctionHandler.cpp | |
parent | df62e30a8883f3c146700f3666442c7ada42ba3c (diff) | |
parent | ad866e123b6be8a160ecb87249884cc3dfc3a349 (diff) | |
download | klee-74d88a5e0d6020fc262c166e42b8acdc335b4999.tar.gz |
Merge pull request #447 from hutoTUM/fix-klee_get_obj_size
Fix for klee_get_obj_size() crashing on 64-bit, resolves #446
Diffstat (limited to 'lib/Core/SpecialFunctionHandler.cpp')
-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 b44b0e1b..0ecbdd07 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; @@ -539,8 +547,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()))); } } |