[compiler-rt] [scudo][NFC] Explicit type casting to avoid compiler warning (PR #83355)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 15:44:56 PST 2024


https://github.com/ChiaHungDuan updated https://github.com/llvm/llvm-project/pull/83355

>From a1c2928f78bd698e0746d7378482a97380278f95 Mon Sep 17 00:00:00 2001
From: Chia-hung Duan <chiahungduan at google.com>
Date: Wed, 28 Feb 2024 23:28:44 +0000
Subject: [PATCH] [scudo][NFC] Explicit type casting to avoid compiler warning

---
 compiler-rt/lib/scudo/standalone/allocator_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/lib/scudo/standalone/allocator_common.h b/compiler-rt/lib/scudo/standalone/allocator_common.h
index 4d39956bf90503..2b77516ad11cae 100644
--- a/compiler-rt/lib/scudo/standalone/allocator_common.h
+++ b/compiler-rt/lib/scudo/standalone/allocator_common.h
@@ -53,7 +53,7 @@ template <class SizeClassAllocator> struct TransferBatch {
   void moveNToArray(CompactPtrT *Array, u16 N) {
     DCHECK_LE(N, Count);
     memcpy(Array, Batch + Count - N, sizeof(Batch[0]) * N);
-    Count -= N;
+    Count = static_cast<u16>(Count - N);
   }
   u16 getCount() const { return Count; }
   bool isEmpty() const { return Count == 0U; }



More information about the llvm-commits mailing list