From 3475a4513748de466a2efde6d8ecd61d611acb26 Mon Sep 17 00:00:00 2001 From: Lancelot SIX Date: Wed, 21 Aug 2024 20:31:33 +0100 Subject: [PATCH] rocr/amd_core_dump: Fix "arithmetic on a pointer to void" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A recent patch introduced a build failure when building with Clang: [ 65%] Building CXX object runtime/hsa-runtime/CMakeFiles/hsa-runtime64.dir/libamdhsacode/amd_core_dump.cpp.o […]/runtime/hsa-runtime/libamdhsacode/amd_core_dump.cpp:271:29: error: arithmetic on a pointer to void 271 | read = pread(fd_, buf + done, buf_size - done, | ~~~ ^ 1 error generated. This patch fixes this by making sure the "void *" pointer is converting to "char *" before doing arithmetic on it. Change-Id: Ib1663ed30abce76e05f06d042975eccd7d729823 --- runtime/hsa-runtime/libamdhsacode/amd_core_dump.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/hsa-runtime/libamdhsacode/amd_core_dump.cpp b/runtime/hsa-runtime/libamdhsacode/amd_core_dump.cpp index 873d637b7..c5dc75bad 100644 --- a/runtime/hsa-runtime/libamdhsacode/amd_core_dump.cpp +++ b/runtime/hsa-runtime/libamdhsacode/amd_core_dump.cpp @@ -268,7 +268,8 @@ struct LoadSegmentBuilder : public SegmentBuilder { size_t done = 0; ssize_t read; do { - read = pread(fd_, buf + done, buf_size - done, offset + done); + read = pread(fd_, static_cast(buf) + done, buf_size - done, + offset + done); if (read == -1 && errno != EINTR) { perror("Failed to read GPU memory");