rocr/coredump: fix void* pointer arithmetic in debug_print#8898
Conversation
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.
❌ PR Check — Action Required
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🚫 Please fix the failed policies before requesting reviews. The following policy checks failed:
The |
|
Closed in favor of #8896 (by @lancesix), which fixes the same |
Problem
#7502(rocr: Fix coredump generation to pipes, and to file on lustrefs, merged todevelop) introduced arithmetic directly on avoid*inamd_core_dump.cpp. This is a GNU extension that GCC accepts but Clang rejects as a hard error: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-TranslatorLinux CI, which checks outrocm-systemsdevelop).Fix
Both sites compute an end pointer (
base + size) passed to a%#pdebug_printargument. Compute the end address viareinterpret_cast<uint64_t>— the same idiom already used by the adjacentfilter.add_range(...)calls and the scratch-range print just above — and cast the result back tovoid*for the%#pspecifier. No behavior change.Notes
debug_printoutput is affected; runtime behavior is unchanged.void*-arithmetic sites in the file.