[compiler-rt] [sanitizer] Fix type in some Min() calls (PR #119248)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 28 18:23:25 PST 2024
================
@@ -532,8 +532,8 @@ INTERCEPTOR(int, strncmp, const char *s1, const char *s2, usize size) {
for (; i1 < size && s1[i1]; i1++) {}
for (; i2 < size && s2[i2]; i2++) {}
}
- COMMON_INTERCEPTOR_READ_RANGE((ctx), (s1), Min(i1 + 1, size));
- COMMON_INTERCEPTOR_READ_RANGE((ctx), (s2), Min(i2 + 1, size));
+ COMMON_INTERCEPTOR_READ_RANGE((ctx), (s1), Min<uptr>(i1 + 1, size));
+ COMMON_INTERCEPTOR_READ_RANGE((ctx), (s2), Min<uptr>(i2 + 1, size));
----------------
arichardson wrote:
IMO it would be cleaner if all of these uptr variables in this function were `usize` since they are sizes and not uintptr_t ("union of pointer and integer").
Would also result in marginally better code generation for CHERI and allows dropping the explicit template argument to min calls.
https://github.com/llvm/llvm-project/pull/119248
More information about the llvm-commits
mailing list