From 399eb5632f4ad201bfe4f0bbe1f8ce302c711726 Mon Sep 17 00:00:00 2001 From: Chia-hung Duan Date: Fri, 7 Jul 2023 19:57:47 +0000 Subject: [PATCH] [scudo] Explicit casting for u16 arithmetic operation This fixes the werror from https://lab.llvm.org/buildbot/#/builders/165/builds/38829 Reviewed By: enh Differential Revision: https://reviews.llvm.org/D154733 --- compiler-rt/lib/scudo/standalone/primary32.h | 2 +- compiler-rt/lib/scudo/standalone/primary64.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/scudo/standalone/primary32.h b/compiler-rt/lib/scudo/standalone/primary32.h index c2fb3e7..0fbc02d 100644 --- a/compiler-rt/lib/scudo/standalone/primary32.h +++ b/compiler-rt/lib/scudo/standalone/primary32.h @@ -553,7 +553,7 @@ private: // TODO(chiahungduan): Avoid the use of push_back() in `Batches` of // BatchClassId. BG->Batches.push_front(CurBatch); - UnusedSlots = BG->MaxCachedPerBatch - 1; + UnusedSlots = static_cast(BG->MaxCachedPerBatch - 1); } // `UnusedSlots` is u16 so the result will be also fit in u16. const u16 AppendSize = static_cast(Min(UnusedSlots, Size - I)); diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h index df4e893..807aeab 100644 --- a/compiler-rt/lib/scudo/standalone/primary64.h +++ b/compiler-rt/lib/scudo/standalone/primary64.h @@ -665,7 +665,7 @@ private: // TODO(chiahungduan): Avoid the use of push_back() in `Batches` of // BatchClassId. BG->Batches.push_front(CurBatch); - UnusedSlots = BG->MaxCachedPerBatch - 1; + UnusedSlots = static_cast(BG->MaxCachedPerBatch - 1); } // `UnusedSlots` is u16 so the result will be also fit in u16. const u16 AppendSize = static_cast(Min(UnusedSlots, Size - I)); -- 2.7.4