# Unsupported / non-standard cases One minimal source per known V3 gap (2026-10-18). Each file's header comment carries its **tag**, its **Modula-2 status**, and the gm2 corpus file(s) it stands for. These are *not* part of the test suite (they are expected to fail); they exist so each case has a runnable example. Verify one with: ```sh cd compiler && ./build.sh ./M2 ../docs/gaps/gap07_convert.mod # prints the diagnostic on stdout ``` ## Policy: follow Modula-2, not degraded gm2 The corpus is **gcc's gm2 testsuite**, so "compiles on the corpus" mixes conforming Modula-2 with **gm2 leniencies and extensions**. This project follows the language: > Standard Modula-2 (PIM and ISO) requires **declaration before use**; > the declaration part is ordered `CONST`, `TYPE`, `VAR`. The only > forward reference the language allows is a **`POINTER`'s base type** > (for recursive/self-referential types). V3 therefore *intentionally rejects* use-before-declaration; that is conforming behaviour, not a gap. gm2 accepts such programs because it resolves the whole declaration part before checking — a **leniency**. The `class` column says what a change would mean: - `decl-order` — **not legal Modula-2**; gm2 leniency. V3 rejects it correctly. *Not a target.* - `gm2-ext` — **not standard**; a gm2/PIM extension or leniency. *Not a target unless we choose gm2 compatibility.* - `iso/system` — a standard ISO Modula-2 / SYSTEM facility V3 lacks. *A genuine gap.* - `v3-deviation` — V3 is **stricter than the standard** (a V3 bug to fix). - `impl-limit` — the language allows it; V3 has a fixed implementation limit. ## Index | tag | file | class | diagnostic | corpus exemplars | | --- | --- | --- | --- | --- | | `gap01-fwd-type-const-conv` | `gap01_fwd_type_const_conv.mod` | `decl-order` | `undeclared identifier` | `subrange4`, `subrange7` | | `gap02-fwd-type-var` | `gap02_fwd_type_var.mod` | `decl-order` | `undeclared identifier` | `subrange11`, `arrayptr`, `arrayptr6`, `constructor1`, `constructor3`, `param3` | | `gap03-fwd-type-heading` | `gap03_fwd_type_heading.mod` | `decl-order` | `undeclared identifier` | `shift3`, `shift4` | | `gap04-fwd-const-bound` | `gap04_fwd_const_bound.mod` | `decl-order` | `undeclared identifier` | `setconst3` | | `gap05-fwd-type-size` | `gap05_fwd_type_size.mod` | `decl-order` | `undeclared identifier` | `constsize2` | | `gap06-fwd-setconst` | `gap06_fwd_setconst.mod` | `decl-order` | `undeclared identifier` | `setoverflow` | | `gap09-scalar-to-bytearray` | `gap09_scalar_to_bytearray.mod` | `gm2-ext` | `invalid call` | `aochar`, `arrayofbyte`, `bytearray` | | `gap10-var-param-type` | `gap10_var_param_type.mod` | `gm2-ext` | `invalid call` | `testparam2`, `testparam3` | | `gap11-bare-proc-stmt` | `gap11_bare_proc_stmt.mod` | `gm2-ext` | `invalid call` | `tinyproc2`, `tinyproc4` | | `gap12-variant-empty-arms` | `gap12_variant_empty_arms.mod` | `gm2-ext` | `invalid VarLabel` | `varient2`, `varient3`, `varient8`, `tsize`, `tsize2` | | `gap14-builtin-pragma` | `gap14_builtin_pragma.def` | `gm2-ext` | `ident expected` | `builtin.def`, `builtin.mod` | | `gap16-wide-set` | `gap16_wide_set.mod` | `impl-limit` | `not supported yet` | `settest1` | | `gap17-set-of-cardinal` | `gap17_set_of_cardinal.mod` | `impl-limit` | `not supported yet` | `settest3` | | `gap18-set-case-labels` | `gap18_set_case_labels.mod` | `gm2-ext` | `not supported yet` | `bitset5` | | `gap19-fwd-array-index` | `gap19_fwd_array_index.mod` | `decl-order` | `not supported yet` | `record7`, `complextypes` | | `gap20-fwd-set-of-type` | `gap20_fwd_set_of_type.mod` | `decl-order` | `undeclared identifier` | `tinyset6`, `tinyset7` | | `gap21-fwd-record-field` | `gap21_fwd_record_field.mod` | `decl-order` | `undeclared identifier` | `record14.def`, `record15.def`, `record16.def` | | `gap22-file-line` | `gap22_file_line.mod` | `gm2-ext` | `invalid Fact` | `packed` | First diagnostic (message) per file at commit time (line:col varies as comments change): ``` gap01_fwd_type_const_conv.mod undeclared identifier (ind0) gap02_fwd_type_var.mod undeclared identifier (arr) gap03_fwd_type_heading.mod undeclared identifier (large) gap04_fwd_const_bound.mod undeclared identifier (n) gap05_fwd_type_size.mod undeclared identifier (t) gap06_fwd_setconst.mod undeclared identifier (CharSet / tab) gap09_scalar_to_bytearray.mod invalid call (scalar -> ARRAY OF BYTE) gap10_var_param_type.mod invalid call (VAR actual type) gap11_bare_proc_stmt.mod invalid call (bare proc value) gap12_variant_empty_arms.mod invalid VarLabel gap14_builtin_pragma.def ident expected (__BUILTIN__) gap16_wide_set.mod not supported yet (span > 65536) gap17_set_of_cardinal.mod not supported yet (unbounded base) gap18_set_case_labels.mod not supported yet (set as CASE selector) gap19_fwd_array_index.mod not supported yet (array index declared later) gap20_fwd_set_of_type.mod undeclared identifier (SET OF base declared later) gap21_fwd_record_field.mod undeclared identifier (record field type declared later) gap22_file_line.mod invalid Fact (__LINE__) ``` ## Genuine gaps (worth fixing, standard Modula-2) - **`gap07` CONVERT — fixed** (2026-10-18): `CONVERT(T, x)` is accepted as a `VAL` sibling (`procconv2` passes). - **`gap08` set↔word `CAST`/`VAL` — fixed** (2026-10-18): `VAL`/`CAST` between a set and its machine word (`constset`, `constset2`, `constset3` pass). `packed` still needs `gap22` (`__FILE__`/`__LINE__`). - **`gap13` builtins as identifiers — the corpus case is fixed** (2026-10-18): `ORDL` (a gm2/FileIO helper, not a Modula-2 built-in) is no longer reserved, so `PROCEDURE ORDL` is accepted (`fileio.def/mod`, `baseimport` pass; the scanner frame now imports `FileIO.ORDL`). The *standard* built-ins (`ORD`, `CHR`, `VAL`, …) are still keyword-style — de-reserving them is a larger parser refactor. - **`gap15` enumeration literals with an imported type — fixed** (2026-10-18): literals now travel with the type through re-export, FROM-import and qualified access; also fixed the qualified-const value (`LoadDesignator` returned 0 for enum consts). `imp*` pass. - Foreign modules `FOR "C"` / `EXPORT UNQUALIFIED` — already fixed (§ STATUS). `gap16`/`gap17` are implementation limits (raising the set span cap). ## Not represented by a source - **Size-sensitive V3 miscompile** — a *latent* codegen bug that only manifests at the compiler's own scale (the historical "removing `ASTDUMP` breaks the fixpoint"); see `docs/summary_l3_selfhost_fix.md`. No small standalone source triggers it.