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

Type mismatch when importing globals? #380

Closed
binji opened this issue Nov 7, 2016 · 3 comments
Closed

Type mismatch when importing globals? #380

binji opened this issue Nov 7, 2016 · 3 comments

Comments

@binji
Copy link
Member

binji commented Nov 7, 2016

I noticed that the spec interpreter fails this test (should be a type mismatch):

(module
  (global i32 (i32.const 0))
  (export "g" (global 0)))
(register "foo")
(assert_unlinkable
  (module (import "foo" "g" (global f32)))
  "blah")

Seems like an oversight?

@rossberg
Copy link
Member

rossberg commented Nov 8, 2016

Well, not really an oversight, rather that it's not clear how to make it work right now. I would be inclined to make that an error in "proper Wasm". But the only way we can currently express linking is through the JS API, and that freely interconverts global imports, because it doesn't have any type information about them to begin with. Morally, the implicit conversion should be part of the JS API, not Wasm linking semantics, but either way you could not express the above test in browsers.

The only solution would be to make it an error in the spec (since that doesn't consider JS) but not include a test in the suite until we have more stringent ways to express linking in browsers.

That said, there is a bug in the interpreter in that it does not perform the coercion for globals that come from other modules, it only does it for host imports. If you'd add "g" to another f32 in the second module then you get a runtime error. So something has to change one way or the other.

@rossberg
Copy link
Member

rossberg commented Nov 10, 2016

See #384, which tightens the check. That seems to be the right thing to do for the spec. However, for the reasons mentioned above, this can't currently be tested in the browser, so no respective test is included for the time being.

@rossberg
Copy link
Member

Fixed by #384

ngzhian pushed a commit to ngzhian/spec that referenced this issue Nov 4, 2021
ngzhian added a commit to ngzhian/spec that referenced this issue Nov 4, 2021
These 4 instructions:

- i32x4.extadd_pairwise_i16x8_s
- i32x4.extadd_pairwise_i16x8_u
- i16x8.extadd_pairwise_i8x16_s
- i16x8.extadd_pairwise_i8x16_u

were merged in WebAssembly#380.

Drive-by cleanup to meta/README.md to list all generated files.
ngzhian added a commit to ngzhian/spec that referenced this issue Nov 4, 2021
dhil pushed a commit to dhil/webassembly-spec that referenced this issue Oct 3, 2023
…lity-in-array-types

Add a test for malformed mutability in array types
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