[llvm] 1c3d0a2 - [llvm-objdump] Fix type mismatch in std::min.
Simon Tatham via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 26 02:02:40 PDT 2022
Author: Simon Tatham
Date: 2022-07-26T10:02:37+01:00
New Revision: 1c3d0a2e8754c942d7bae6dda36812b99538ce7a
URL: https://github.com/llvm/llvm-project/commit/1c3d0a2e8754c942d7bae6dda36812b99538ce7a
DIFF: https://github.com/llvm/llvm-project/commit/1c3d0a2e8754c942d7bae6dda36812b99538ce7a.diff
LOG: [llvm-objdump] Fix type mismatch in std::min.
I broke the build just now by trying to do std::min between a size_t
and a uint64_t, which of course worked fine on my 64-bit test platform.
Added:
Modified:
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/tools/sancov/sancov.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 3a260b0d350fb..fd83dc197fe9a 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1128,8 +1128,8 @@ static void collectLocalBranchTargets(
bool Disassembled =
DisAsm->getInstruction(Inst, Size, ThisBytes, Index, nulls());
if (Size == 0)
- Size = std::min(ThisBytes.size(),
- DisAsm->suggestBytesToSkip(ThisBytes, Index));
+ Size = std::min<uint64_t>(ThisBytes.size(),
+ DisAsm->suggestBytesToSkip(ThisBytes, Index));
if (Disassembled && MIA) {
uint64_t Target;
@@ -1175,8 +1175,8 @@ static void addSymbolizer(
ArrayRef<uint8_t> ThisBytes = Bytes.slice(Index - SectionAddr);
DisAsm->getInstruction(Inst, Size, ThisBytes, Index, nulls());
if (Size == 0)
- Size = std::min(ThisBytes.size(),
- DisAsm->suggestBytesToSkip(ThisBytes, Index));
+ Size = std::min<uint64_t>(ThisBytes.size(),
+ DisAsm->suggestBytesToSkip(ThisBytes, Index));
Index += Size;
}
ArrayRef<uint64_t> LabelAddrsRef = SymbolizerPtr->getReferencedAddresses();
@@ -1648,8 +1648,9 @@ static void disassembleObject(const Target *TheTarget, ObjectFile &Obj,
bool Disassembled = DisAsm->getInstruction(Inst, Size, ThisBytes,
ThisAddr, CommentStream);
if (Size == 0)
- Size = std::min(ThisBytes.size(),
- DisAsm->suggestBytesToSkip(ThisBytes, ThisAddr));
+ Size = std::min<uint64_t>(
+ ThisBytes.size(),
+ DisAsm->suggestBytesToSkip(ThisBytes, ThisAddr));
LVP.update({Index, Section.getIndex()},
{Index + Size, Section.getIndex()}, Index + Size != End);
diff --git a/llvm/tools/sancov/sancov.cpp b/llvm/tools/sancov/sancov.cpp
index e8d271a0c124e..e7c985c558b5c 100644
--- a/llvm/tools/sancov/sancov.cpp
+++ b/llvm/tools/sancov/sancov.cpp
@@ -787,8 +787,9 @@ static void getObjectCoveragePoints(const object::ObjectFile &O,
uint64_t ThisAddr = SectionAddr + Index;
if (!DisAsm->getInstruction(Inst, Size, ThisBytes, ThisAddr, nulls())) {
if (Size == 0)
- Size = std::min(ThisBytes.size(),
- DisAsm->suggestBytesToSkip(ThisBytes, ThisAddr));
+ Size = std::min<uint64_t>(
+ ThisBytes.size(),
+ DisAsm->suggestBytesToSkip(ThisBytes, ThisAddr));
continue;
}
uint64_t Addr = Index + SectionAddr;
More information about the llvm-commits
mailing list