Skip to content
This repository has been archived by the owner on Dec 24, 2024. It is now read-only.

Commit

Permalink
rocr/amd_core_dump: Fix "arithmetic on a pointer to void"
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lancesix authored and dayatsin-amd committed Aug 21, 2024
1 parent eb30a5b commit 3475a45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/hsa-runtime/libamdhsacode/amd_core_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char *>(buf) + done, buf_size - done,
offset + done);

if (read == -1 && errno != EINTR) {
perror("Failed to read GPU memory");
Expand Down

0 comments on commit 3475a45

Please sign in to comment.