Recover packed range checks and half-adjusted arithmetic #819

Manually merged
binjovi-bot merged 2 commits from rpg-packed-operand-evidence into trunk 2026-11-19 17:10:40 +00:00
Owner

Recover packed range checks and half-adjusted arithmetic

The emitter uses a packed parameter's proved precision and scale to recover
decimal bounds in compound comparisons. When a multiply and divide end in a
half-adjusted store, the two discarded places and the destination scale can
identify the operands and the precision of %DECH. Conflicting or ambiguous
literal scales keep the ordinary diagnostic.

A complete free-form listing with original statement numbers can also retain
one unused name-shaped character literal in a dcl-c. The declaration uses
a blank line before the first statement. A binding directory and an unused
constant can produce the same stripped object, so the declaration preserves
the literal without assigning it a binding role.

Verification

The DB2 for i example emits all 14 statements and recompiles to a strict IBM i object match. Across 43 public programs this branch independently moves verified matches from 12 to 13 and independent upstream repositories from eight to nine. All 42 other emitted listings and DDS sets are byte-identical to v0.1.534.

The pinned build-image suite passed. The native gate recorded 14 cases on each binary.

== 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)
l10-andymalo43-ibelieve-2026-db2-for-i-u-1 base=[14,13,1] head=[14,14,0] CHANGED fail-lines=0
packed-range-both base=[5,5,0] head=[5,5,0] CHANGED fail-lines=0
scaled-round-field-half base=[9,9,0] head=[9,9,0] CHANGED fail-lines=0
scaled-round-literal-half base=[9,8,1] head=[9,9,0] CHANGED fail-lines=0
packed-field-rounded base=[9,9,0] head=[9,9,0] CHANGED fail-lines=0
retained-text-unused base=[2,2,0] head=[2,2,0] CHANGED fail-lines=0
capture-emit-diff: 17 cases, 6 changed, 14 with no failure line in the head emit
== e. source agreement (agree)
suspect        base=7 head=4
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: 14
l10-scout2/l10-andymalo43-ibelieve-2026-db2-for-i-u/l10-andymalo43-ibelieve-2026-db2-for-i-u-1 base=different 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=different 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=different head=match
packed-field-qualification-20261119/packed-field-rounded base=different head=match
retained-text-proof-20261119/retained-text-absent  base=match head=match
retained-text-proof-20261119/retained-text-unused  base=different head=match
retained-text-proof-20261119/retained-text-used    base=match head=match
gate: PASS
# Recover packed range checks and half-adjusted arithmetic The emitter uses a packed parameter's proved precision and scale to recover decimal bounds in compound comparisons. When a multiply and divide end in a half-adjusted store, the two discarded places and the destination scale can identify the operands and the precision of `%DECH`. Conflicting or ambiguous literal scales keep the ordinary diagnostic. A complete free-form listing with original statement numbers can also retain one unused name-shaped character literal in a `dcl-c`. The declaration uses a blank line before the first statement. A binding directory and an unused constant can produce the same stripped object, so the declaration preserves the literal without assigning it a binding role. ## Verification The DB2 for i example emits all 14 statements and recompiles to a strict IBM i object match. Across 43 public programs this branch independently moves verified matches from 12 to 13 and independent upstream repositories from eight to nine. All 42 other emitted listings and DDS sets are byte-identical to v0.1.534. The pinned build-image suite passed. The native gate recorded 14 cases on each binary. ``` == 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) l10-andymalo43-ibelieve-2026-db2-for-i-u-1 base=[14,13,1] head=[14,14,0] CHANGED fail-lines=0 packed-range-both base=[5,5,0] head=[5,5,0] CHANGED fail-lines=0 scaled-round-field-half base=[9,9,0] head=[9,9,0] CHANGED fail-lines=0 scaled-round-literal-half base=[9,8,1] head=[9,9,0] CHANGED fail-lines=0 packed-field-rounded base=[9,9,0] head=[9,9,0] CHANGED fail-lines=0 retained-text-unused base=[2,2,0] head=[2,2,0] CHANGED fail-lines=0 capture-emit-diff: 17 cases, 6 changed, 14 with no failure line in the head emit == e. source agreement (agree) suspect base=7 head=4 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: 14 l10-scout2/l10-andymalo43-ibelieve-2026-db2-for-i-u/l10-andymalo43-ibelieve-2026-db2-for-i-u-1 base=different 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=different 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=different head=match packed-field-qualification-20261119/packed-field-rounded base=different head=match retained-text-proof-20261119/retained-text-absent base=match head=match retained-text-proof-20261119/retained-text-unused base=different head=match retained-text-proof-20261119/retained-text-used base=match head=match gate: PASS ```
sean force-pushed rpg-packed-operand-evidence from e197f73a5e to f4083ba96e
Some checks failed
binjovi/ci Binjovi failed the frozen plan
2026-11-19 11:07:56 +00:00
Compare
sean force-pushed rpg-packed-operand-evidence from f4083ba96e
Some checks failed
binjovi/ci Binjovi failed the frozen plan
to aff8b4c4e2
All checks were successful
binjovi/ci Binjovi completed the frozen plan
2026-11-19 16:53:55 +00:00
Compare
binjovi-bot manually merged commit aff8b4c4e2 into trunk 2026-11-19 17:10:40 +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!819
No description provided.