[libc-commits] [libc] [libc] Expand usage of libc null checks. (PR #116262)
Aly ElAshram via libc-commits
libc-commits at lists.llvm.org
Fri Feb 7 16:20:16 PST 2025
================
@@ -17,6 +18,8 @@ namespace LIBC_NAMESPACE_DECL {
// TODO: Look at performance benefits of comparing words.
LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) {
+ const unsigned char *src_cpy = (const unsigned char *)src;
+ LIBC_CRASH_ON_NULLPTR(src_cpy);
----------------
AlyElashram wrote:
Also from my understanding casting a nullptr is not UB , as I'm only changing the type information and not actually accessing the data inside the pointer no ?
https://github.com/llvm/llvm-project/pull/116262
More information about the libc-commits
mailing list