about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2018-05-08 11:00:14 +0100
committerMartinNowack <martin.nowack@gmail.com>2018-05-21 18:00:55 +0100
commit5165772d3f03314fb61cc47256b67d923605c951 (patch)
treed781a6874db394936c8431c510dd36e7ce94159c /lib
parent33964e5d935f903b2850f6576f93ce229fb00918 (diff)
downloadklee-5165772d3f03314fb61cc47256b67d923605c951.tar.gz
fix some casts for LLP64 compilers
Diffstat (limited to 'lib')
-rw-r--r--lib/Core/AddressSpace.cpp4
-rw-r--r--lib/Core/Executor.cpp12
-rw-r--r--lib/Core/ExecutorUtil.cpp2
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/Core/AddressSpace.cpp b/lib/Core/AddressSpace.cpp
index 2169ed06..32bcdcc5 100644
--- a/lib/Core/AddressSpace.cpp
+++ b/lib/Core/AddressSpace.cpp
@@ -298,7 +298,7 @@ void AddressSpace::copyOutConcretes() {
 
     if (!mo->isUserSpecified) {
       ObjectState *os = it->second;
-      uint8_t *address = (uint8_t*) (unsigned long) mo->address;
+      auto address = reinterpret_cast<std::uint8_t*>(mo->address);
 
       if (!os->readOnly)
         memcpy(address, os->concreteStore, mo->size);
@@ -324,7 +324,7 @@ bool AddressSpace::copyInConcretes() {
 
 bool AddressSpace::copyInConcrete(const MemoryObject *mo, const ObjectState *os,
                                   uint64_t src_address) {
-  uint8_t *address = (uint8_t *)(unsigned long)src_address;
+  auto address = reinterpret_cast<std::uint8_t*>(src_address);
   if (memcmp(address, os->concreteStore, mo->size) != 0) {
     if (os->readOnly) {
       return false;
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index f7c71e8d..308b4456 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -487,8 +487,8 @@ void Executor::initializeGlobalObject(ExecutionState &state, ObjectState *os,
 MemoryObject * Executor::addExternalObject(ExecutionState &state, 
                                            void *addr, unsigned size, 
                                            bool isReadOnly) {
-  MemoryObject *mo = memory->allocateFixed((uint64_t) (unsigned long) addr, 
-                                           size, 0);
+  auto mo = memory->allocateFixed(reinterpret_cast<std::uint64_t>(addr),
+                                  size, nullptr);
   ObjectState *os = bindObjectInState(state, mo, false);
   for(unsigned i = 0; i < size; i++)
     os->write8(i, ((uint8_t*)addr)[i]);
@@ -520,8 +520,8 @@ void Executor::initializeGlobals(ExecutionState &state) {
         !externalDispatcher->resolveSymbol(f->getName())) {
       addr = Expr::createPointer(0);
     } else {
-      addr = Expr::createPointer((unsigned long) (void*) f);
-      legalFunctions.insert((uint64_t) (unsigned long) (void*) f);
+      addr = Expr::createPointer(reinterpret_cast<std::uint64_t>(f));
+      legalFunctions.insert(reinterpret_cast<std::uint64_t>(f));
     }
     
     globalAddresses.insert(std::make_pair(f, addr));
@@ -1564,7 +1564,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
       destinations.insert(d);
 
       // create address expression
-      const auto PE = Expr::createPointer((uint64_t) (unsigned long) (void *) d);
+      const auto PE = Expr::createPointer(reinterpret_cast<std::uint64_t>(d));
       ref<Expr> e = EqExpr::create(address, PE);
 
       // exclude address from errorCase
@@ -1814,7 +1814,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
 
             // Don't give warning on unique resolution
             if (res.second || !first)
-              klee_warning_once((void*) (unsigned long) addr, 
+              klee_warning_once(reinterpret_cast<void*>(addr),
                                 "resolved symbolic function pointer to: %s",
                                 f->getName().data());
 
diff --git a/lib/Core/ExecutorUtil.cpp b/lib/Core/ExecutorUtil.cpp
index a0f4de3d..355f6f78 100644
--- a/lib/Core/ExecutorUtil.cpp
+++ b/lib/Core/ExecutorUtil.cpp
@@ -122,7 +122,7 @@ namespace klee {
       } else if (const BlockAddress * ba = dyn_cast<BlockAddress>(c)) {
         // return the address of the specified basic block in the specified function
         const auto arg_bb = (BasicBlock *) ba->getOperand(1);
-        const auto res = Expr::createPointer((uint64_t) (unsigned long) (void *) arg_bb);
+        const auto res = Expr::createPointer(reinterpret_cast<std::uint64_t>(arg_bb));
         return cast<ConstantExpr>(res);
       } else {
         std::string msg("Cannot handle constant ");