[PATCH] D147837: [WebAssembly] Fix type index block type handling in type checker

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 02:05:49 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8c0798f36835: [WebAssembly] Fix type index block type handling in type checker (authored by aheejin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147837/new/

https://reviews.llvm.org/D147837

Files:
  llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
  llvm/test/MC/WebAssembly/type-checker-errors.s


Index: llvm/test/MC/WebAssembly/type-checker-errors.s
===================================================================
--- llvm/test/MC/WebAssembly/type-checker-errors.s
+++ llvm/test/MC/WebAssembly/type-checker-errors.s
@@ -221,13 +221,20 @@
   drop
   end_function
 
-end_block_insufficient_values_on_stack:
-  .functype end_block_insufficient_values_on_stack () -> ()
+end_block_insufficient_values_on_stack_1:
+  .functype end_block_insufficient_values_on_stack_1 () -> ()
   block i32
 # CHECK: :[[@LINE+1]]:3: error: end: insufficient values on the type stack
   end_block
   end_function
 
+end_block_insufficient_values_on_stack_2:
+  .functype end_block_insufficient_values_on_stack_2 () -> ()
+  block () -> (i32)
+# CHECK: :[[@LINE+1]]:3: error: end: insufficient values on the type stack
+  end_block
+  end_function
+
 end_block_type_mismatch:
   .functype end_block_type_mismatch () -> ()
   block i32
Index: llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
+++ llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
@@ -637,10 +637,10 @@
       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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147837.512371.patch
Type: text/x-patch
Size: 1683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230411/d04aa07e/attachment.bin>


More information about the llvm-commits mailing list