Skip to content

Incorrect implementations of unreachable ref.as_non_null validation #2235

Description

@tlively

V8, SpiderMonkey, and JavaScriptCore all say this invalid module is valid:

(module
  (func $invalid
    (local $i32 i32)
    (unreachable)
    (ref.as_non_null)
    (local.set $i32)
  )
)

I guess production engines never bothered to implement (ref ⊥), so they just have the ref.as_non_null push in this situation. The reference interpreter and wasm-tools get this right. WABT gets this wrong. Binaryen doesn't even try to validate unreachable code correctly.

We should probably add a spec test for this, but OTOH that would be really annoying for the engines for no real benefit.

Maybe it's time to revisit the relaxed dead code validation proposal 🤔

cc @conrad-watt

Metadata

Metadata

Assignees

No one assigned

    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