From: Chia-hung Duan Date: Fri, 7 Jul 2023 19:57:47 +0000 (+0000) Subject: [scudo] Explicit casting for u16 arithmetic operation X-Git-Tag: upstream/17.0.6~2494 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=399eb5632f4ad201bfe4f0bbe1f8ce302c711726;p=platform%2Fupstream%2Fllvm.git [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 --- 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));