From 5165772d3f03314fb61cc47256b67d923605c951 Mon Sep 17 00:00:00 2001 From: Frank Busse Date: Tue, 8 May 2018 11:00:14 +0100 Subject: fix some casts for LLP64 compilers --- lib/Core/AddressSpace.cpp | 4 ++-- lib/Core/Executor.cpp | 12 ++++++------ lib/Core/ExecutorUtil.cpp | 2 +- 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(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(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(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(f)); + legalFunctions.insert(reinterpret_cast(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(d)); ref 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(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(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(arg_bb)); return cast(res); } else { std::string msg("Cannot handle constant "); -- cgit 1.4.1