[clang] [clang][Sema] Diagnose passing function pointer to `__builtin_assume_aligned` (PR #153552)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 14 17:30:34 PDT 2025


localspook wrote:

I've switched to `checkBuiltinArgument`, but it causes an issue that I'd like input on before I continue. `clang/test/CodeGen/catch-alignment-assumption-ignorelist.c` tests that UBSan doesn't validate the alignment of pointers to volatile. With this change, the `volatile`-ness of the pointer is lost when passed into `__builtin_assume_aligned`, so the UBSan checks are generated. To *me* this seems like an improvement; after all, checking alignment does not dereference the pointer, so why does it matter if it points to volatile? [Several UBSan checks have this exception](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#volatile), but I don't understand the motivation behind it.

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


More information about the cfe-commits mailing list