Preserve padded writes to the first structure field #821

Manually merged
binjovi-bot merged 2 commits from padded-first-proof-20261119 into trunk 2026-11-19 23:52:23 +00:00
Owner

Preserve padded writes to the first structure field

A padded assignment to the first character field of a structure could be
emitted as an assignment to the entire structure. That changes the compiler's
write width and can overwrite neighboring fields. After translating the whole
module, the emitter now identifies the narrower field only when the complete
direct write and padding are contained in one statement and the proved fields
cover the structure without gaps or overlaps. Known arrays and layouts with
unproved gaps stay unchanged, and the first field must be larger than half the
structure to rule out a repeated-element layout. A whole-structure assignment
remains whole.

The public first-field control changes from a different IBM i object to a
match; the whole-structure control remains a match. Two constant-index array
controls remain unchanged. The proof also refuses malformed or truncated
instruction sequences.

Gate

== a. development emits (dev-hash)
p1 same
p2 same
p3 same
p4 same
p5 same
== b. L10-test direction
L10-test unchanged
== c. committed twins (emit-bytes-diff)
emit-bytes-diff: identical
== d. captures (capture-emit-diff)
padded-first-simple base=[4,4,0] head=[4,4,0] CHANGED fail-lines=0
vtrim-first-part base=[6,5,1] head=[6,5,1] CHANGED fail-lines=1
vtrim-second-part base=[6,5,1] head=[6,5,1] CHANGED fail-lines=1
vtrim-prefix-part base=[6,5,1] head=[6,5,1] CHANGED fail-lines=1
capture-emit-diff: 32 cases, 4 changed, 19 with no failure line in the head emit
== e. source agreement (agree)
suspect        base=12 head=12
conflict       base=0 head=0
params_wrong   base=0 head=0
decl_missing   base=0 head=0
decl_extra     base=0 head=0
type_unmarked  base=0 head=0
== f. host round trips (both binaries)
cases to round-trip: 19
l10-scout2/l10-andymalo43-ibelieve-2026-db2-for-i-u/l10-andymalo43-ibelieve-2026-db2-for-i-u-1 base=match head=match
packed-public-proof-20261119/packed-range-above    base=different head=different
packed-public-proof-20261119/packed-range-below    base=match head=match
packed-public-proof-20261119/packed-range-both     base=match head=match
packed-public-proof-20261119/packed-round-factor-half base=different head=different
packed-public-proof-20261119/packed-round-factor-truncate base=different head=different
packed-scale-proof-20261119/scaled-round-extra-place base=different head=different
packed-scale-proof-20261119/scaled-round-field-half base=different head=different
packed-scale-proof-20261119/scaled-round-field-truncate base=different head=different
packed-scale-proof-20261119/scaled-round-literal-half base=match head=match
packed-field-qualification-20261119/packed-field-rounded base=match head=match
retained-text-proof-20261119/retained-text-absent  base=match head=match
retained-text-proof-20261119/retained-text-unused  base=match head=match
retained-text-proof-20261119/retained-text-used    base=match head=match
clear-assigned-public-20261119/clear-assigned      base=match head=match
clear-reset-controls-20261119/clear-nondefault     base=match head=match
clear-large-public-20261119/clear-large            base=match head=match
padded-part-simple-public-20261119/padded-first-simple base=different head=match
padded-part-simple-public-20261119/padded-whole-simple base=match head=match
gate: PASS
## Preserve padded writes to the first structure field A padded assignment to the first character field of a structure could be emitted as an assignment to the entire structure. That changes the compiler's write width and can overwrite neighboring fields. After translating the whole module, the emitter now identifies the narrower field only when the complete direct write and padding are contained in one statement and the proved fields cover the structure without gaps or overlaps. Known arrays and layouts with unproved gaps stay unchanged, and the first field must be larger than half the structure to rule out a repeated-element layout. A whole-structure assignment remains whole. The public first-field control changes from a different IBM i object to a match; the whole-structure control remains a match. Two constant-index array controls remain unchanged. The proof also refuses malformed or truncated instruction sequences. ## Gate ``` == a. development emits (dev-hash) p1 same p2 same p3 same p4 same p5 same == b. L10-test direction L10-test unchanged == c. committed twins (emit-bytes-diff) emit-bytes-diff: identical == d. captures (capture-emit-diff) padded-first-simple base=[4,4,0] head=[4,4,0] CHANGED fail-lines=0 vtrim-first-part base=[6,5,1] head=[6,5,1] CHANGED fail-lines=1 vtrim-second-part base=[6,5,1] head=[6,5,1] CHANGED fail-lines=1 vtrim-prefix-part base=[6,5,1] head=[6,5,1] CHANGED fail-lines=1 capture-emit-diff: 32 cases, 4 changed, 19 with no failure line in the head emit == e. source agreement (agree) suspect base=12 head=12 conflict base=0 head=0 params_wrong base=0 head=0 decl_missing base=0 head=0 decl_extra base=0 head=0 type_unmarked base=0 head=0 == f. host round trips (both binaries) cases to round-trip: 19 l10-scout2/l10-andymalo43-ibelieve-2026-db2-for-i-u/l10-andymalo43-ibelieve-2026-db2-for-i-u-1 base=match head=match packed-public-proof-20261119/packed-range-above base=different head=different packed-public-proof-20261119/packed-range-below base=match head=match packed-public-proof-20261119/packed-range-both base=match head=match packed-public-proof-20261119/packed-round-factor-half base=different head=different packed-public-proof-20261119/packed-round-factor-truncate base=different head=different packed-scale-proof-20261119/scaled-round-extra-place base=different head=different packed-scale-proof-20261119/scaled-round-field-half base=different head=different packed-scale-proof-20261119/scaled-round-field-truncate base=different head=different packed-scale-proof-20261119/scaled-round-literal-half base=match head=match packed-field-qualification-20261119/packed-field-rounded base=match head=match retained-text-proof-20261119/retained-text-absent base=match head=match retained-text-proof-20261119/retained-text-unused base=match head=match retained-text-proof-20261119/retained-text-used base=match head=match clear-assigned-public-20261119/clear-assigned base=match head=match clear-reset-controls-20261119/clear-nondefault base=match head=match clear-large-public-20261119/clear-large base=match head=match padded-part-simple-public-20261119/padded-first-simple base=different head=match padded-part-simple-public-20261119/padded-whole-simple base=match head=match gate: PASS ```
binjovi-bot manually merged commit 445718a08d into trunk 2026-11-19 23:52:23 +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!821
No description provided.