[PATCH] D121852: [scudo] Use templated builtins to avoid assumptions on SCUDO_WORDSIZE
Dominic Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 28 16:36:47 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9343fc76133b: [scudo] Use cast on calls to __builtin_umul_overflow/__builtin_umull_overflow (authored by ddcc).
Changed prior to commit:
https://reviews.llvm.org/D121852?vs=418353&id=418728#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121852/new/
https://reviews.llvm.org/D121852
Files:
compiler-rt/lib/scudo/standalone/wrappers_c_checks.h
Index: compiler-rt/lib/scudo/standalone/wrappers_c_checks.h
===================================================================
--- compiler-rt/lib/scudo/standalone/wrappers_c_checks.h
+++ compiler-rt/lib/scudo/standalone/wrappers_c_checks.h
@@ -47,9 +47,12 @@
// costly division.
inline bool checkForCallocOverflow(uptr Size, uptr N, uptr *Product) {
#if __has_builtin(__builtin_umull_overflow) && (SCUDO_WORDSIZE == 64U)
- return __builtin_umull_overflow(Size, N, Product);
+ return __builtin_umull_overflow(Size, N,
+ reinterpret_cast<unsigned long *>(Product));
#elif __has_builtin(__builtin_umul_overflow) && (SCUDO_WORDSIZE == 32U)
- return __builtin_umul_overflow(Size, N, Product);
+ // On, e.g. armv7, uptr/uintptr_t may be defined as unsigned long
+ return __builtin_umul_overflow(Size, N,
+ reinterpret_cast<unsigned int *>(Product));
#else
*Product = Size * N;
if (!Size)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121852.418728.patch
Type: text/x-patch
Size: 965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220328/272a4146/attachment.bin>
More information about the llvm-commits
mailing list