|
|
@@ -1,17 +1,26 @@
|
|
|
MODULE NestedArrayFieldBug;
|
|
|
(* Repro: a RECORD field that is a nested ARRAY OF ARRAY OF CHAR, accessed
|
|
|
as `arr[i].field[j][k]`, is miscompiled by V3 -> segfault (rc 139).
|
|
|
- Observed 2026-10-05; the flat-array form works (rc 42).
|
|
|
+ Observed 2026-10-05. Expected exit 42; observed 139.
|
|
|
|
|
|
Found while adding Lower's procedure-formal name table (a module-level
|
|
|
ARRAY OF RECORD with a `pname : ARRAY [0..31] OF ARRAY [0..63] OF
|
|
|
CHAR` field): the V3-built compiler crashed (SIGABRT) on every input.
|
|
|
- Flattening the field to `ARRAY [0..2047] OF CHAR` fixed the crash.
|
|
|
+ Flattening the field to `ARRAY [0..2047] OF CHAR` fixed that crash.
|
|
|
+
|
|
|
+ STATUS (2026-10-05):
|
|
|
+ - The *stride* half is FIXED (commit v3-fix-arrayrec-stride):
|
|
|
+ QbeGen.ArrBodyItems now uses SymTab.TypeSize for record/class/set
|
|
|
+ array elements, so an ARRAY OF record has correct element size and
|
|
|
+ flat field access works (see tests/t_recarr.mod, exit 42).
|
|
|
+ - This nested case STILL crashes: a record element inside an array
|
|
|
+ is emitted as a zero blob, and its nested-array field's
|
|
|
+ sub-descriptors (`$arr_i_field_k`) are never emitted, so the
|
|
|
+ field's pointers are null. Fixing it needs per-element
|
|
|
+ RecStatics/RecItems in ArrBodyItems/ArrData.
|
|
|
|
|
|
Compare with docs/wip/local-array-bug.mod (local arrays) and the
|
|
|
- Stage-A array-of-record stride fix (QbeGen.ElemSize). Likely the
|
|
|
- element stride / descriptor-pointer setup for a nested-array field is
|
|
|
- wrong. Expected exit 42; observed 139. *)
|
|
|
+ Stage-A array-of-record stride fix (QbeGen.ElemSize). *)
|
|
|
|
|
|
VAR ExitCode : INTEGER;
|
|
|
|