unreachable

unreachable is used to denote a point in code that should not be reachable. In the case where an unreachable is reached it throws an unrecoverable error.

Syntax

unreachable

Full working example

Wasm file

(module
  (func (export "throw")
    unreachable
  )
)

JavaScript file

WebAssembly.instantiateStreaming(
  fetch("../out/main.wasm")
).then(result => {
  result.instance.exports.throw();
});
Opcode
unreachable 0x00