Skip to content

Missing validation error #8785

Open

Description

@mkustermann

See jj.tar.gz.

Unpack via:

% tar xvzf jj.tar.gz
...

When running with V8 we get a validation error:

% d8 $PWD/pkg/dart2wasm/bin/run_wasm.js  -- $PWD/jj.mjs $PWD/jj.wasm   
run_wasm.js:346: CompileError: WebAssembly.compile(): Compiling function #181:"main" failed: not enough arguments on the stack for drop (need 1, got 0) @+25996
  }
  ^
CompileError: WebAssembly.compile(): Compiling function #181:"main" failed: not enough arguments on the stack for drop (need 1, got 0) @+25996

1 pending unhandled Promise rejection(s) detected.

Though optimizing with wasm-opt works fine and the result runs:

% wasm-opt --enable-gc --enable-reference-types --enable-multivalue --enable-exception-handling --enable-nontrapping-float-to-int --enable-sign-ext --enable-bulk-memory --enable-threads --enable-simd '--no-inline=*<noInline>*' --traps-never-happen -g -Os --gufa -Os -Os jj.wasm -o jj.wasm  
% d8 $PWD/pkg/dart2wasm/bin/run_wasm.js  -- $PWD/jj.mjs $PWD/jj.wasm
%

Is wasm-opt not supposed to issue a validation error here as well? (even though the corresponding code is unreachable)

        local.get $reporter
        drop
        drop
        block $label2
          unreachable
        end
        drop

Activity

  1. tlively commented on May 28, 2026

    @tlively
    Member

    This is WAI for now, unfortunately. Binaryen represents that block as having bottom type internally, so this parses into valid Binaryen IR, even though it is not valid WebAssembly. A fix would involve adding an entirely new validator in the parser, since the IR does not retain enough information to detect this error.

  2. added a commit that references this issue on Aug 16, 2026
    999c1cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions