aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2023-04-07 20:29:25 -0700
committerHeejin Ahn <aheejin@gmail.com>2023-04-11 02:04:56 -0700
commit8c0798f368356e50f59a2598b28e7cac8770ea4c (patch)
tree918545187172f1a809d73e9491a5696729bc71a6 /llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
parentd0027e0be990df60f6f826123f035286a168f288 (diff)
downloadllvm-8c0798f368356e50f59a2598b28e7cac8770ea4c.zip
llvm-8c0798f368356e50f59a2598b28e7cac8770ea4c.tar.gz
llvm-8c0798f368356e50f59a2598b28e7cac8770ea4c.tar.bz2
[WebAssembly] Fix type index block type handling in type checker
The current code is ``` ExpectBlockType = false; TC.setLastSig(*Signature.get()); if (ExpectBlockType) NestingStack.back().Sig = *Signature.get(); ``` Because of the first line, the third line's `if (ExpectBlockType)` is always false and we don't get to update `NestingStack.back().Sig`. This results in not correctly erroring out when the types of remaining values on the stack do not match the block type if the block type is written in the form of a function type. We should set `ExpectBlockType` to false after the `if`. Reviewed By: sbc100 Differential Revision: https://reviews.llvm.org/D147837
Diffstat (limited to 'llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
index ded5abd..eeffc5a 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -637,10 +637,10 @@ public:
if (parseSignature(Signature.get()))
return true;
// Got signature as block type, don't need more
- ExpectBlockType = false;
TC.setLastSig(*Signature.get());
if (ExpectBlockType)
NestingStack.back().Sig = *Signature.get();
+ ExpectBlockType = false;
auto &Ctx = getContext();
// The "true" here will cause this to be a nameless symbol.
MCSymbol *Sym = Ctx.createTempSymbol("typeindex", true);