Eric Streit 38833a3e09 docs(gaps): classify each gap (standard vs gm2 leniency vs V3 bug) 4 дней назад
..
README.md 38833a3e09 docs(gaps): classify each gap (standard vs gm2 leniency vs V3 bug) 4 дней назад
gap01_fwd_type_const_conv.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap02_fwd_type_var.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap03_fwd_type_heading.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap04_fwd_const_bound.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap05_fwd_type_size.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap06_fwd_setconst.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap07_convert.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap08_val_cast_set_word.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap09_scalar_to_bytearray.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap10_var_param_type.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap11_bare_proc_stmt.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap12_variant_empty_arms.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap13_builtin_proc_name.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap14_builtin_pragma.def d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap15_base.def d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap15_lib.def d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap15a_qualified_import.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap15b_from_import.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap16_wide_set.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад
gap17_set_of_cardinal.mod d718a1ee34 docs: one minimal reproducer per unsupported gap (docs/gaps/) 4 дней назад

README.md

Unsupported-gap reproducers

One minimal source per known V3 gap (2026-10-18). Each file's header comment carries its tag 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 gap has a runnable, self-contained example.

Verify one with:

cd compiler && ./build.sh
./M2 ../docs/gaps/gap07_convert.mod     # prints the diagnostic on stdout

Classifying the gaps

The corpus is gcc's gm2 testsuite, so "compiles on the corpus" mixes standard Modula-2 with gm2 leniencies and extensions. Standard Modula-2 (PIM and ISO) requires declaration before use; the only forward reference the language allows is a POINTER's base type (for recursive/self-referential types). V3 deliberately enforces that order, so the decl-order cases below are not missing language features — they are gm2 accepting non-conforming programs.

The class column says what a fix would mean:

  • decl-order — gm2 resolves the whole declaration part; strict M-2 forbids the use-before-declaration. Not a standard feature.
  • iso/system — a standard ISO Modula-2 / SYSTEM facility V3 lacks.
  • gm2-ext — a gm2/PIM extension or a leniency (not portable M-2).
  • v3-deviation — V3 is stricter than the standard (a V3 bug).
  • 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 (procedure-local part)
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
gap07-convert-builtin gap07_convert.mod iso/system undeclared identifier procconv2
gap08-set-word-cast gap08_val_cast_set_word.mod iso/system not supported yet constset, constset2, constset3, packed, bitset5
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
gap13-builtin-proc-name gap13_builtin_proc_name.mod v3-deviation ident expected fileio.def, fileio.mod
gap14-builtin-pragma gap14_builtin_pragma.def gm2-ext ident expected builtin.def, builtin.mod
gap15a-qualified-import gap15a_qualified_import.mod (+ gap15_base.def, gap15_lib.def) iso/system undeclared identifier impf, impk, impl, impq
gap15b-from-import gap15b_from_import.mod (+ gap15_base.def, gap15_lib.def) iso/system undeclared identifier impi
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

Observed first diagnostics (line:col) at commit time:

gap01_fwd_type_const_conv.mod:5:13   undeclared identifier
gap02_fwd_type_var.mod:7:9           undeclared identifier
gap03_fwd_type_heading.mod:5:17      undeclared identifier
gap04_fwd_const_bound.mod:5:19       undeclared identifier
gap05_fwd_type_size.mod:5:17         undeclared identifier
gap06_fwd_setconst.mod:5:12          undeclared identifier
gap07_convert.mod:8:12               undeclared identifier
gap08_val_cast_set_word.mod:7:35     not supported yet
gap09_scalar_to_bytearray.mod:9:13   invalid call
gap10_var_param_type.mod:9:11        invalid call
gap11_bare_proc_stmt.mod:6:7         invalid call
gap12_variant_empty_arms.mod:8:12    invalid VarLabel
gap13_builtin_proc_name.mod:5:11     ident expected
gap14_builtin_pragma.def:5:11        ident expected
gap15a_qualified_import.mod:8:21     undeclared identifier
gap15b_from_import.mod:6:16          undeclared identifier
gap16_wide_set.mod:5:29              not supported yet
gap17_set_of_cardinal.mod:5:19       not supported yet

Why gap01–gap06 are not standard Modula-2

All six name an identifier before its declaration:

CONST low = ind0(-100);        (* ind0's TYPE section comes later *)
TYPE  ind0 = [-100..100];

gm2 accepts this because it resolves the whole declaration part; PIM/ISO Modula-2 require declaration before use (only a POINTER's base type is exempt). V3 rejecting them is standard-conforming. They are listed for corpus-compatibility accounting, not as missing language features.

gap13 is the opposite case: ORDL is not a reserved word in Modula-2 (ORD, CHR, VAL, … are predeclared identifiers, not keywords), so PROCEDURE ORDL … is legal standard M-2 and V3 is wrong to reject it.

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.

Companion files (gap15_base.def, gap15_lib.def) are not gaps themselves; they model the impc → impb re-export chain.