Skip to content

trap_gate systemic trap-equivalence gate (#284/#279) is never called by any pass — inert; trap-soundness still rests on the is_no_trap stopgaps it claims to supersede #288

Description

@avrabe

Summary

The systemic trap-equivalence gate added in #284 (commit a1f3daf, "feat(#279): systemic trap-equivalence gate … supersedes is_no_trap stopgaps") — loom-core/src/trap_gate.rs — is never called by any optimization pass or the verify path. It is dead code. #279 was closed on the belief this gate is now the systemic authority, but it provides zero runtime protection; actual trap-soundness still rests entirely on the per-pass is_no_trap static guards that #273/#274/#276/#278/#281 each added by hand.

Evidence (loom 1.2.0 @ a1f3daf)

The module doc asserts it is active authority:

//! Systemic trap-equivalence gate (issue #279).
//! This module is the durable cure: a trap-equivalence obligation … supersedes the per-pass is_no_trap stopgaps

But the only reference to trap_gate anywhere outside its own file is the module declaration:

loom-core/src/lib.rs:15425:  pub mod trap_gate;

Every public entry point has 0 external callers (grep across loom-core/src + loom-cli/src, excluding trap_gate.rs and its own #[test]s):
check_div_transform, check_mem_transform, check_select_discard, check_trap_equivalence_under, prove_under_premises, signed_div_value, mem_bound_from_pages — none referenced.

What the optimize/verify path actually consults for trap-safety is Summary::is_no_trap (verify.rs:464, lib.rs:8842/8919/13631, summary.rs) — the ad-hoc stopgaps the gate claims to supersede. The gate's 13 #[test]s exercise it in isolation, so it compiles and CI is green, but no pass ever calls it.

Why it matters

Current output soundness is intact (verified: OOB-load/store, div/rem-by-0, INT_MIN/-1 folds all still trap after loom optimize — the is_no_trap stopgaps hold). This report is about the inert safety-critical gate and its overstated claim, not a current miscompile.

Suggested action

Wire trap_gate into the passes it was built for (div/mem/select-discard transforms) so it actually gates those folds, or downgrade the module/commit claims and reopen #279 until the systemic gate is on the runtime path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions