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

invalid type mismatch #290

Closed
wanderer opened this issue May 17, 2016 · 4 comments
Closed

invalid type mismatch #290

wanderer opened this issue May 17, 2016 · 4 comments
Milestone

Comments

@wanderer
Copy link

The following code generates this error when ran
test.wast:21.28-21.42: type mismatch: expression has type i32 but the context requires i64
code:

(module
  (func $test
    (param $a i64)
    (local $b i64)
    (param $c i64)
    (local $d i64)
    (param $e i64)
    (local $f i64)
    (param $g i64)
    (local $h i64)

    (param $i i64)
    (local $j i64)
    (param $k i64)
    (local $l i64)
    (param $m i64)
    (local $n i64)
    (param $o i64)

    (param $memIndex i32)
    (set_local $i (i64.and (get_local $i) (i64.const 4294967295)))
  )
)

if I remove one (and it doesn't matter which one) param or local it runs without error

@wanderer
Copy link
Author

wanderer commented May 18, 2016

I think this is related too, the following test fails to return the correct value

(module
  (func $sub
    (param $a1 i64)
    (param $b1 i64)
    (param $c1 i64)
    (param $d1 i64)
    (local $carry i32)
    (param $i i32)
    (result i32)
    (get_local $i)
  )

  (export "sub" $sub)
)

(assert_return (invoke "sub"  (i64.const -1) (i64.const -1) (i64.const -1) (i64.const -1) (i32.const 24)) (i32.const 24))

@wanderer
Copy link
Author

so when I arrange all the params to be at the top then the locals everything works

@sunfishcode sunfishcode added this to the MVP milestone May 18, 2016
@rossberg
Copy link
Member

rossberg commented May 19, 2016 via email

@rossberg
Copy link
Member

Addressed in #291 by making a misplaced local a syntax error.

rossberg added a commit that referenced this issue May 30, 2016
Fixes #290 by imposing a strict order on param, result, and local declarations.
ngzhian added a commit to ngzhian/spec that referenced this issue Nov 4, 2021
This is a simple change, validation and execution is already
shape-agnostic, so we only need to add it to the syntax.

Instructions were merged in WebAssembly#290.
ngzhian added a commit to ngzhian/spec that referenced this issue Nov 4, 2021
This was merged in WebAssembly#290.

Also tweaked the file generation scripts:

- Make simd_arithmetic more generic (allow different instruction name
patterns)
- create a new file simd_int_to_int_widen to generate all integer
widening operations (including the ones implemented in this PR)
- remove widening tests from simd_conversions.wast
rossberg added a commit that referenced this issue Feb 28, 2024
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

3 participants