summary_session-2026-10-23.md 2.2 KB

Session 2026-10-23 — continuation: range checks; PACKEDSET inspection

Branch master. Continues summary_session-2026-10-22.md from the 2026-10-22 stop point (v3-smallfix).

Numbers

gate start end
suite (compiler/run_tests.sh) 259/259 262/262
fixpoint (bootstrap/fixpoint.sh) OK (4,028,447 B) OK (4,032,793 B)
corpus (tools/v3-corpus/corpus.sh) 511/612 511/612, 0 crashes

What landed

Runtime subrange range checks — Lower + QbeGen.CheckRange

V3 accepted base-typed values into CHAR/enum subranges but emitted no runtime check. Lower.CheckSub now traps (abort) when the value is outside the destination subrange on:

  • assignment (scalar, field or array element);
  • a value actual whose formal is a subrange;
  • RETURN whose function result is a subrange;
  • INC/DEC on a subrange.

The post-increment of a FOR control variable is exempt: the final successor of a loop over a full subrange (FOR x := 0 TO 3 with x: [0..3]) may legitimately exceed the upper bound. LONGINT subranges are not checked yet.

Regressions: t_trap_range (assignment), t_trap_range_arg (actual), t_trap_range_ret (RETURN); t_subrange remains the in-range case.

PACKEDSET — inspected, parked

The handoff suggested starting with PACKEDSET. Inspection of onebyte* shows it is not safe to alias to SET:

  • SIZE(PACKEDSET) = SIZE(BYTE) = 1 is asserted;
  • ORD(set) is asserted (e.g. ORD(si) = 2, ORD(se) = 32);
  • onebyte3 uses an ARRAY OF PACKEDSET and checks neighbouring bytes.

A faithful implementation needs a 1/2/4-byte packed representation and packed set operations, not just a parser alias. It is parked in docs/handoff-2026-10-23-next.md / docs/gaps/README.md. Corpus stays at 511.

Commits

commit tag work
54d84b9 v3-rangechecks runtime subrange range checks (+3 trap tests)

Remaining

See docs/handoff-2026-10-23-next.md. The next candidates are PACKEDSET (with a real representation), ISO exceptions (dedicated session), multi-dimensional open arrays (ABI decision), and the library-folder / separate-compilation plans (both deferred).