Proving Integer Divisions Do Not Trap

wasm-nontrapping-divides.wasm is a conservative static checker for WebAssembly integer division and remainder instructions. It returns the input module unchanged when every operation is proven non-trapping and traps when a proof is missing.

make -j qip components/application/wasm/wasm-nontrapping-divides.wasm

qip run \
  -i component.wasm \
  -- components/application/wasm/wasm-nontrapping-divides.wasm \
  > checked.wasm

The checker recognizes constants, straightforward dominating guards, and unsigned value ranges:

This is commonly called divide-by-zero analysis in static-analysis tools. nontrapping is more precise for WebAssembly because signed integer division has a second trapping case.

The checker is intentionally sound and incomplete. A successful result is a useful guarantee; a rejection means only that the current checker could not prove the guarantee. More expression forms and loop invariants can be added without changing that meaning.

Use wasm-counts.wasm when you only need to inventory division and remainder sites. Use this checker when an unproven site should fail a pipeline.