[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
Fri Mar 25 16:06:58 PDT 2022


ddcc updated this revision to Diff 418353.
ddcc added a comment.

Use cast instead of template


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
@@ -49,7 +49,9 @@
 #if __has_builtin(__builtin_umull_overflow) && (SCUDO_WORDSIZE == 64U)
   return __builtin_umull_overflow(Size, N, 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.418353.patch
Type: text/x-patch
Size: 747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220325/d2b25412/attachment.bin>


More information about the llvm-commits mailing list