Skip to content

rocr/coredump: fix void* pointer arithmetic in debug_print#8898

Closed
lamb-j wants to merge 1 commit into
developfrom
users/lambj/fix-coredump-void-ptr-arith
Closed

rocr/coredump: fix void* pointer arithmetic in debug_print#8898
lamb-j wants to merge 1 commit into
developfrom
users/lambj/fix-coredump-void-ptr-arith

Conversation

@lamb-j

@lamb-j lamb-j commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Problem

#7502 (rocr: Fix coredump generation to pipes, and to file on lustrefs, merged to develop) introduced arithmetic directly on a void* in amd_core_dump.cpp. This is a GNU extension that GCC accepts but Clang rejects as a hard error:

amd_core_dump.cpp:325:21: error: arithmetic on a pointer to void
amd_core_dump.cpp:339:65: error: arithmetic on a pointer to void

This breaks any Clang build of rocr-runtime. It surfaced in the SPIRV-LLVM-Translator CI, which builds rocr-runtime with the AMD Clang it just built (ROCm/SPIRV-LLVM-Translator Linux CI, which checks out rocm-systems develop).

Fix

Both sites compute an end pointer (base + size) passed to a %#p debug_print argument. Compute the end address via reinterpret_cast<uint64_t> — the same idiom already used by the adjacent filter.add_range(...) calls and the scratch-range print just above — and cast the result back to void* for the %#p specifier. No behavior change.

Notes

  • Only diagnostic debug_print output is affected; runtime behavior is unchanged.
  • These were the only two void*-arithmetic sites in the file.

Arithmetic directly on a void* is a GNU extension that Clang rejects as
an error ("arithmetic on a pointer to void"), breaking Clang builds of
rocr-runtime after #7502:

  amd_core_dump.cpp:325: error: arithmetic on a pointer to void
  amd_core_dump.cpp:339: error: arithmetic on a pointer to void

Both are end-pointer computations passed to a %#p debug_print argument.
Compute the end address via reinterpret_cast<uint64_t> (matching the
idiom already used by the adjacent filter.add_range calls) and cast the
result back to void* for the format specifier.
@therock-pr-bot

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ❌ Fail Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
JIRA ID : TESTAUTO-6039
JIRA ID - #330
JIRA ID #330
JIRA ID (on separate line)
ROCM-25757
ISSUE ID : TESTUTO-3334
ISSUE ID #3334
ISSUE ID - TESTAUTO-3433
ISSUE ID (on separate line)
AIRUNTIME-2352
ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
Closes #10
Fixes octo-org/octo-repo#100
Resolves: #123
#123
https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
Forbidden Files ✅ Pass
🧪 Unit Test ❌ Fail Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rocr-runtime/runtime/hsa-runtime/libamdhsacode/lnx/amd_core_dump.cpp; no test file found
🔎 pre-commit ⏳ Pending ⏳ Still running…
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 2 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Title/Description
  • ❌ Unit Test

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Title/Description
  • ❌ Unit Test

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@lamb-j
lamb-j requested a review from lancesix July 20, 2026 23:10
@lamb-j lamb-j closed this Jul 20, 2026
@lamb-j

lamb-j commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Closed in favor of #8896 (by @lancesix), which fixes the same void* arithmetic errors and additionally clears the %#p -Wformat UB warnings by standardizing the range prints on %#" PRIx64 + uint64_t. That's the more complete fix and is owned by the author of the original change. Note: this regression is currently breaking Clang builds of rocr-runtime (e.g. the ROCm/SPIRV-LLVM-Translator Linux CI), so landing #8896 would unblock it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant