[llvm] 1689d14 - [WebAssembly] fix typo in range check for Asm locals
Wouter van Oortmerssen via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 12 13:07:56 PDT 2021
Author: Wouter van Oortmerssen
Date: 2021-07-12T13:07:11-07:00
New Revision: 1689d14ed1b826e9e9ef1a70e078ae413fdd538c
URL: https://github.com/llvm/llvm-project/commit/1689d14ed1b826e9e9ef1a70e078ae413fdd538c
DIFF: https://github.com/llvm/llvm-project/commit/1689d14ed1b826e9e9ef1a70e078ae413fdd538c.diff
LOG: [WebAssembly] fix typo in range check for Asm locals
Added:
Modified:
llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
index e79fcd34c3f33..2f9245a7c66c0 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
@@ -102,8 +102,8 @@ bool WebAssemblyAsmTypeCheck::popType(SMLoc ErrorLoc,
bool WebAssemblyAsmTypeCheck::getLocal(SMLoc ErrorLoc, const MCInst &Inst,
wasm::ValType &Type) {
- auto Local = Inst.getOperand(0).getImm();
- if (static_cast<size_t>(Local) > LocalTypes.size())
+ auto Local = static_cast<size_t>(Inst.getOperand(0).getImm());
+ if (Local >= LocalTypes.size())
return typeError(ErrorLoc, StringRef("no local type specified for index ") +
std::to_string(Local));
Type = LocalTypes[Local];
More information about the llvm-commits
mailing list