Skip to content

Commit 828467a

Browse files
committed
Fix warnings introduced in #111434 [-Wnontrivial-memaccess]
1 parent 6588073 commit 828467a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lld/ELF/Symbols.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Symbol {
7575

7676
// The default copy constructor is deleted due to atomic flags. Define one for
7777
// places where no atomic is needed.
78-
Symbol(const Symbol &o) { memcpy(this, &o, sizeof(o)); }
78+
Symbol(const Symbol &o) { memcpy(static_cast<void *>(this), &o, sizeof(o)); }
7979

8080
protected:
8181
const char *nameData;

llvm/include/llvm/Support/Endian.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ template <typename value_type, std::size_t alignment = unaligned>
5858
[[nodiscard]] inline value_type read(const void *memory, endianness endian) {
5959
value_type ret;
6060

61-
memcpy(&ret,
61+
memcpy(static_cast<void *>(&ret),
6262
LLVM_ASSUME_ALIGNED(
6363
memory, (detail::PickAlignment<value_type, alignment>::value)),
6464
sizeof(value_type));

llvm/lib/ExecutionEngine/ExecutionEngine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ void ExecutionEngine::StoreValueToMemory(const GenericValue &Val,
10561056
*((double*)Ptr) = Val.DoubleVal;
10571057
break;
10581058
case Type::X86_FP80TyID:
1059-
memcpy(Ptr, Val.IntVal.getRawData(), 10);
1059+
memcpy(static_cast<void *>(Ptr), Val.IntVal.getRawData(), 10);
10601060
break;
10611061
case Type::PointerTyID:
10621062
// Ensure 64 bit target pointers are fully initialized on 32 bit hosts.

0 commit comments

Comments
 (0)