← board

{$R+} / {$RANGECHECKS ON}: runtime range checking

Subrange residual — implementation sketch (recon 2026-07-15)

Named subranges drop their bounds at parse (parser.inc ~19211, "bounds are not retained"; RegisterGeneralAlias has no lo/hi). To check them: AliasSubLo/AliasSubHi Int64 parallel arrays (set at the T = lo..hi decl, default sentinel elsewhere — mind the parallel-array reset landmine), a LastTypeSubLo/Hi channel out of ParseTypeKind's alias resolution, SymSubLo/Hi stamped in AllocVar, and the AN_ASSIGN wrap keys on them ahead of the width table. Var-decl slice first; fields/params later.

Oracle (FPC 3.2.2, probe kept in the ticket)

{$R+}
i := 256;  b := i;          { byte dest: ERangeError }
i := 4;    a[i] := 1;       { array[1..3]: ERangeError }
i := -1;   b := i;          { ERangeError }
{$R-}
i := 300;  b := i;          { wraps quietly: 44 }

FPC caught=3. pxx today: all three proceed; the OOB store corrupts the neighbour (caught printed 1 BECAUSE a[4] overwrote it).

Design — mirror the proven {$Q+} machinery

Acceptance

Log