[compiler-rt] 399eb56 - [scudo] Explicit casting for u16 arithmetic operation
Chia-hung Duan via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 7 12:58:55 PDT 2023
Author: Chia-hung Duan
Date: 2023-07-07T19:58:02Z
New Revision: 399eb5632f4ad201bfe4f0bbe1f8ce302c711726
URL: https://github.com/llvm/llvm-project/commit/399eb5632f4ad201bfe4f0bbe1f8ce302c711726
DIFF: https://github.com/llvm/llvm-project/commit/399eb5632f4ad201bfe4f0bbe1f8ce302c711726.diff
LOG: [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
Added:
Modified:
compiler-rt/lib/scudo/standalone/primary32.h
compiler-rt/lib/scudo/standalone/primary64.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/primary32.h b/compiler-rt/lib/scudo/standalone/primary32.h
index c2fb3e7dd1fc1a..0fbc02d10d08cd 100644
--- a/compiler-rt/lib/scudo/standalone/primary32.h
+++ b/compiler-rt/lib/scudo/standalone/primary32.h
@@ -553,7 +553,7 @@ template <typename Config> class SizeClassAllocator32 {
// TODO(chiahungduan): Avoid the use of push_back() in `Batches` of
// BatchClassId.
BG->Batches.push_front(CurBatch);
- UnusedSlots = BG->MaxCachedPerBatch - 1;
+ UnusedSlots = static_cast<u16>(BG->MaxCachedPerBatch - 1);
}
// `UnusedSlots` is u16 so the result will be also fit in u16.
const u16 AppendSize = static_cast<u16>(Min<u32>(UnusedSlots, Size - I));
diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index df4e8931c6cb94..807aeabb7cd763 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -665,7 +665,7 @@ template <typename Config> class SizeClassAllocator64 {
// TODO(chiahungduan): Avoid the use of push_back() in `Batches` of
// BatchClassId.
BG->Batches.push_front(CurBatch);
- UnusedSlots = BG->MaxCachedPerBatch - 1;
+ UnusedSlots = static_cast<u16>(BG->MaxCachedPerBatch - 1);
}
// `UnusedSlots` is u16 so the result will be also fit in u16.
const u16 AppendSize = static_cast<u16>(Min<u32>(UnusedSlots, Size - I));
More information about the llvm-commits
mailing list