Declare the static fields that no statement names #713

Manually merged
binjovi-bot merged 1 commit from l4-declarations into trunk 2026-11-04 12:06:31 +00:00
Owner

Declare the static fields that no statement names

The compiler keeps the symbol of a field that no statement names (scale-one:
spare packed(9:2); ftwin14-x1: A char(10)), but unusedFields declared
only a field that an initial value proved. A static field of the source range
whose kind and length give a type (rpg_source_unused.shaped: int of 1, 2 or 4
bytes, uns of 2, 4 or 8, packed, zoned, float(8), char of 2 or more) is now
declared with that type when it has no initial value other than the default and
the program has no files. A 1-byte field stays undeclared: it can be char(1),
ind or a flag of the compiler.

The decimal positions of an unused packed or zoned field are the type keywords
that nothing else explains (rpg_source_scale.unexplained, the rule of
missingScale as a list). The creation data holds no scale for such a field
(SCALE-AMBIGUITY: scale-one and scale-two compile to the same object), so any
pairing of the keywords with the fields gives the object; assignUnused takes
the smallest keyword left that the digits hold, in symbol order, else 0. When a
field of the statements has unproved positions the unused fields wait, because
missingScale gives that field the keyword.

Measured offline (Debug build, emit-all against the trunk build): failures,
statements and emitted are equal, no row is worse, and no match row changes
its text. Thirty programs gain a declaration; none of them is a match row.
Matching their rebuilt objects waits for the host.

The saved image of a RESET (33 F; 33 V; 32 V 0 T; 42 F 0 T, rpg_source_unused.resetImage)
is a compiler field with the flags of a source field; it is not declared. The
existing assertion of rpg_source_polish_test r6a-reset-two (its image is not
declared) stays as it was: the first version of this change declared the
images, and that test caught it.

Red first: on trunk the three tests of rpg_decl_types_test.zig that declare an
unused field (ftwin14-x1 char(10), ftwin18-d7 char(50), scale-one spare)
fail, because trunk declares none of them; the RESET-image test passes on trunk
and guards the new rule.

Hand-off (not fixed here; the files belong to other lanes): r6a-reset-ds and
r6a-reset-two keep their SOURCERER-FAIL lines. A padded store narrower than its
field is not folded: rpg_eval.zig folds the blank fill only when the store is
the whole field (whole), so statement S256.0 = 'beta'; %SUBST(S256.4: 1: 6) = *ALL' ' of a 13-byte structure stays two statements, and paddedReference in
rpg_source.zig marks the symbol padded_zero, so the structure is not one.

Gates

{"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","emit":{"worse":[],"better":0,"newly_clean":0,"clean_delta":0,"base":322,"new":322},"twins":{"groups":462,"recovered":454,"regressions":[],"newly":0},"allgroups":{"regressions":[],"newly":[],"worse":[]},"full_check":{"exit":0,"seconds":924}}
# Declare the static fields that no statement names The compiler keeps the symbol of a field that no statement names (scale-one: `spare packed(9:2)`; ftwin14-x1: `A char(10)`), but `unusedFields` declared only a field that an initial value proved. A static field of the source range whose kind and length give a type (`rpg_source_unused.shaped`: int of 1, 2 or 4 bytes, uns of 2, 4 or 8, packed, zoned, float(8), char of 2 or more) is now declared with that type when it has no initial value other than the default and the program has no files. A 1-byte field stays undeclared: it can be `char(1)`, `ind` or a flag of the compiler. The decimal positions of an unused packed or zoned field are the type keywords that nothing else explains (`rpg_source_scale.unexplained`, the rule of `missingScale` as a list). The creation data holds no scale for such a field (SCALE-AMBIGUITY: scale-one and scale-two compile to the same object), so any pairing of the keywords with the fields gives the object; `assignUnused` takes the smallest keyword left that the digits hold, in symbol order, else 0. When a field of the statements has unproved positions the unused fields wait, because `missingScale` gives that field the keyword. Measured offline (Debug build, emit-all against the trunk build): failures, statements and emitted are equal, no row is worse, and no `match` row changes its text. Thirty programs gain a declaration; none of them is a `match` row. Matching their rebuilt objects waits for the host. The saved image of a RESET (`33 F; 33 V; 32 V 0 T; 42 F 0 T`, `rpg_source_unused.resetImage`) is a compiler field with the flags of a source field; it is not declared. The existing assertion of `rpg_source_polish_test` r6a-reset-two (its image is not declared) stays as it was: the first version of this change declared the images, and that test caught it. Red first: on trunk the three tests of `rpg_decl_types_test.zig` that declare an unused field (ftwin14-x1 `char(10)`, ftwin18-d7 `char(50)`, scale-one `spare`) fail, because trunk declares none of them; the RESET-image test passes on trunk and guards the new rule. Hand-off (not fixed here; the files belong to other lanes): r6a-reset-ds and r6a-reset-two keep their SOURCERER-FAIL lines. A padded store narrower than its field is not folded: `rpg_eval.zig` folds the blank fill only when the store is the whole field (`whole`), so statement `S256.0 = 'beta'; %SUBST(S256.4: 1: 6) = *ALL' '` of a 13-byte structure stays two statements, and `paddedReference` in `rpg_source.zig` marks the symbol `padded_zero`, so the structure is not one. ## Gates ``` {"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","emit":{"worse":[],"better":0,"newly_clean":0,"clean_delta":0,"base":322,"new":322},"twins":{"groups":462,"recovered":454,"regressions":[],"newly":0},"allgroups":{"regressions":[],"newly":[],"worse":[]},"full_check":{"exit":0,"seconds":924}} ```
binjovi-bot manually merged commit 5f1960aa20 into trunk 2026-11-04 12:06:31 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sean/sourcerer!713
No description provided.