Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another valid modules fails validation #83

Closed
fitzgen opened this issue Aug 20, 2020 · 4 comments · Fixed by #84
Closed

Another valid modules fails validation #83

fitzgen opened this issue Aug 20, 2020 · 4 comments · Fixed by #84
Labels
wasmparser Related to the binary format of WebAssembly (wasmparser)

Comments

@fitzgen
Copy link
Member

fitzgen commented Aug 20, 2020

test.wasm.gz

(module
  (type (func))
  (type (func (result f64 i32)))
  (func (type 1)
    loop
      br 0
      call 0
      br_if 0
      i32.trunc_f64_u
      unreachable
    end
    unreachable
  )
)

Haven't started investigating yet, but it looks pretty similar to the last one: unreachable code (following the unconditional br) and a br_if instruction.

cc @yurydelendik

@fitzgen fitzgen added the wasmparser Related to the binary format of WebAssembly (wasmparser) label Aug 20, 2020
@yurydelendik
Copy link
Contributor

I cannot reproduce atm. It requires --enable-multi-value with "wasm-validate-rs" and looks like it is passing in wabt's "wasm-validate".

@fitzgen
Copy link
Member Author

fitzgen commented Aug 20, 2020

Ah woops, I translated the example to wat by hand wrong, here is the correct stuff:

test.wasm.gz

(module
  (type (;0;) (func))
  (type (;1;) (func (result f64 i32)))
  (func (;0;) (type 1) (result f64 i32)
    loop (result f64 i32)  ;; label = @1
      br 0 (;@1;)
      call 0
      br_if 0 (;@1;)
      i32.trunc_f64_u
      unreachable
    end
    unreachable))

@fitzgen
Copy link
Member Author

fitzgen commented Aug 20, 2020

I get

Error: stack operand type mismatch (at offset 84)

Sorry for uploading the wrong wat!

@fitzgen
Copy link
Member Author

fitzgen commented Aug 20, 2020

(with --enable-multi-value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmparser Related to the binary format of WebAssembly (wasmparser)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants