[llvm] 828467a - Fix warnings introduced in #111434 [-Wnontrivial-memaccess]
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 28 22:18:54 PDT 2024
Author: NAKAMURA Takumi
Date: 2024-10-29T14:18:24+09:00
New Revision: 828467a54e156cbb04820ae47df32c45fbc75fc0
URL: https://github.com/llvm/llvm-project/commit/828467a54e156cbb04820ae47df32c45fbc75fc0
DIFF: https://github.com/llvm/llvm-project/commit/828467a54e156cbb04820ae47df32c45fbc75fc0.diff
LOG: Fix warnings introduced in #111434 [-Wnontrivial-memaccess]
Added:
Modified:
lld/ELF/Symbols.h
llvm/include/llvm/Support/Endian.h
llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index 339f32e05f1625..8c9c9a56cfbc72 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -75,7 +75,7 @@ class Symbol {
// The default copy constructor is deleted due to atomic flags. Define one for
// places where no atomic is needed.
- Symbol(const Symbol &o) { memcpy(this, &o, sizeof(o)); }
+ Symbol(const Symbol &o) { memcpy(static_cast<void *>(this), &o, sizeof(o)); }
protected:
const char *nameData;
diff --git a/llvm/include/llvm/Support/Endian.h b/llvm/include/llvm/Support/Endian.h
index 5831fe66a1f7b7..f86ea8901ae46b 100644
--- a/llvm/include/llvm/Support/Endian.h
+++ b/llvm/include/llvm/Support/Endian.h
@@ -58,7 +58,7 @@ template <typename value_type, std::size_t alignment = unaligned>
[[nodiscard]] inline value_type read(const void *memory, endianness endian) {
value_type ret;
- memcpy(&ret,
+ memcpy(static_cast<void *>(&ret),
LLVM_ASSUME_ALIGNED(
memory, (detail::PickAlignment<value_type, alignment>::value)),
sizeof(value_type));
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index f09975331bba84..42622ea12152ab 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -1056,7 +1056,7 @@ void ExecutionEngine::StoreValueToMemory(const GenericValue &Val,
*((double*)Ptr) = Val.DoubleVal;
break;
case Type::X86_FP80TyID:
- memcpy(Ptr, Val.IntVal.getRawData(), 10);
+ memcpy(static_cast<void *>(Ptr), Val.IntVal.getRawData(), 10);
break;
case Type::PointerTyID:
// Ensure 64 bit target pointers are fully initialized on 32 bit hosts.
More information about the llvm-commits
mailing list