Просмотр исходного кода

docs: corpus sweep 2026-10-18 record (findings: set constants, builtin CONST folding)

Eric Streit 12 часов назад
Родитель
Сommit
d3aad6f981
1 измененных файлов с 27 добавлено и 0 удалено
  1. 27 0
      docs/analysis_gaps.md

+ 27 - 0
docs/analysis_gaps.md

@@ -165,3 +165,30 @@ Two concrete, corpus-visible language gaps found while auditing those
    caveat in mind if extending it.
 
 Neither is started; both are bounded and corpus-measurable.
+
+## 9. Corpus sweep 2026-10-18 (continuing §8)
+
+Landed (each with a suite test, corpus measured):
+**`ODD`/`TRUNC`/`FLOAT`** builtins (+4), **BOOLEAN/ENUM array bounds +
+indices** (+5), **`SET OF <enum>` literals** (+0), **forward type
+reference in `SET OF <type>`** (+1).  Corpus **372 -> 382**, 0 crashes.
+
+Investigating further surfaced two gaps that are **features, not
+one-liners** (deliberately left as `230`, no silent miscompile):
+
+1. **Set constants** (`CONST Digits = CharSet{"0".."9"}`, `setconst*.mod`).
+   Accepting the *declaration* is easy (treat `ClSet` as an aggregate in
+   `ConstDecl` and the designator's `KindConst` branch — both written and
+   **reverted**), but the *value* needs static data: a set literal is
+   emitted as a **runtime temp** (`NewSetTemp`/`SetZero`/`SetBit`), and
+   `QbeGen.DeclSet` only emits a zeroed blob.  The fix is to compute the
+   mask at parse time and emit `data $X = { w <mask>... }` (plus a
+   `Lower` re-emit path).  Reverted until that exists.
+2. **Builtin calls in `CONST` initialisers** (`CONST A = CAP(VAL(CHAR,
+   65))`, `testcap2.mod`; `MIN`/`MAX` of sets, `minmaxreal3`,
+   `testlongint`).  `VAL` over ordinals already leaves the operand's
+   immediate in place, but `CAP`/`ABS`/`ODD`/… set the runtime sentinel
+   `"@"`, so `ConstDecl`'s `IsImm` check rejects them.  A principled fix
+   is to fold these builtins when their operand is an immediate.
+
+Both are bounded once the static-mask / fold helpers exist.