[clang] [Clang] Correctly handle UBSan libraries for the GPU (PR #188290)

Manuel Carrasco via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 09:57:25 PDT 2026


mgcarrasco wrote:

> > > The trap version should work, I don't think what you had worked before because the only sanitizer accepted by the ROCm Toolchain was `address`. The version with a runtime will need a few modifications to work, but I'm planning for a follow-up.
> > 
> > 
> > I've checked out this PR's branch and the above example failed, although it doesn't look to me that it has UB. Is this an expected failure in terms of the functionalities that the PR is adding?
> > Yes, you're right that the only sanitizer accepted is `address`. I had had to locally change the driver to test UBSan in trap mode.
> 
> Interesting, I'll try once I've finished a build on another branch. First thought is, you're checking `function` directly instead of broader `undefined`? Is that the one that checks for indirect calls? Maybe it doesn't like `printf`.

Thanks! Yes, my understanding is that the above command is instrumenting the indirect calls check. The check is also included in `-fsanitize=undefined -fsanitize-trap=all`. Removing the `printf`s also triggers the trap on my side.

This is just a guess, if it is not printf, could it be something related to how `__global__` and `__device__` affect function calls?



https://github.com/llvm/llvm-project/pull/188290


More information about the cfe-commits mailing list