Skip to content

type error in unreachable code on block-sigs branch #338

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

Closed
sunfishcode opened this issue Sep 11, 2016 · 4 comments
Closed

type error in unreachable code on block-sigs branch #338

sunfishcode opened this issue Sep 11, 2016 · 4 comments
Milestone

Comments

@sunfishcode
Copy link
Member

The block-sigs branch has this testcase in loop.wast:

(assert_invalid
  (module (func $type-cont-last-void-vs-empty (result i32)
    (loop (br 0 (nop)))
  ))
  "type mismatch"
)

The end of the function is unreachable, so implementations shouldn't be required to issue a type error here, by my understanding of the rules.

@sunfishcode
Copy link
Member Author

type-cont-last-num-vs-empty also in loop.wast is another instance of this.

@ghost
Copy link

ghost commented Sep 11, 2016

With the block signatures, the loop has a declared result type, in this case void so the validation can easily use that, it does not need to propagate unreachable types. This seems consistent with (i32.add (f32.neg (unreachable))) being a type error too, here f32.neg has a declared type which is used even though it's result is unreachable.

This also seems to be related to WebAssembly/design#778

@rossberg
Copy link
Member

@sunfishcode, acknowledged. Block signatures notwithstanding, the interpreter still implements the don't-type-check-dead-code semantics, which is why I didn't find these when I adapted the tests. Not skipping dead code is gonna be a separate change.

@sunfishcode sunfishcode modified the milestone: MVP Sep 30, 2016
@rossberg
Copy link
Member

This has been fixed with #345.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants