[compiler-rt] [compiler-rt] Add SPIR-V target support for UBSan Minimal Runtime (PR #195979)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Wed May 6 10:00:03 PDT 2026
jhuber6 wrote:
> The existing code tries to format the error message on a stack buffer and then print it. That's what we can't support for GPU in common case. The SPIR-V target, the `printf` requires all the string operands to be literals, or to be resolved to literals.
That's news to me, it's supposed to just call printf. Does this not work in SPIR-V? Their printf support isn't very useful if not.
```c
static void format(const char *kind, uintptr_t caller) {
#if SANITIZER_AMDGPU || SANITIZER_NVPTX
(void)format_msg;
message("ubsan: %s by %p\n", kind, reinterpret_cast<void *>(caller));
#else
char msg_buf[128];
format_msg(kind, caller, msg_buf, msg_buf + sizeof(msg_buf));
message(msg_buf);
#endif
}
```
> Also, the old code uses the `abort()` function from the libc, that is not available for the SPIR-V target.
Are you reading a really old version of this? That calls `__builtin_verbose_trap` now.
https://github.com/llvm/llvm-project/pull/195979
More information about the llvm-commits
mailing list