diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp --- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp +++ b/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); diff --git a/llvm/test/MC/WebAssembly/type-checker-errors.s b/llvm/test/MC/WebAssembly/type-checker-errors.s --- a/llvm/test/MC/WebAssembly/type-checker-errors.s +++ b/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