Skip to content

Invalid non-nullable local binary emitting related to unreachability #5599

Description

@kripken
(module
 (func $test (param $ref (ref struct)) 
  (local $local (ref struct))
  (drop
   (block (result i32)
    (local.set $local
     (unreachable)       ;; this causes validation of the later local.get to fail
     ;; (local.get $ref) ;; this would be ok
    )
    (i32.const 0)
   )
  )
  (drop
   (local.get $local)
  )
 )
)

bin/wasm-as -all --nominal wat -o wasm emits a binary that V8 complains about, uninitialized non-defaultable local. Binaryen does accept the binary as valid, oddly. Also oddly, replacing the unreachable with something reachable fixes it in V8.

I think Binaryen thinks this validates since the unnamed block is not emitted in the binary format, so the local.set dominates the local.get. But perhaps unreachability makes us behave differently somehow?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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