rpg_source.zig: the indicator at byte 0 of a local data structure is a subfield, and a varying-length subfield is a failure line #793

Manually merged
binjovi-bot merged 1 commit from ldsv into trunk 2026-11-13 14:30:17 +00:00
Owner

rpg_source.zig: the indicator at byte 0 of a local data structure is a subfield, and a varying-length subfield is a failure line

A local data structure declared likeds(T) whose template has approved ind; note varchar(50); (the public
program asyncprom, decision of approveAll, symbol 339, 53 bytes) was emitted as

dcl-ds CAPTUREERROR_00339 qualified;   G0 char(1);  F1 uns(5);  G3 char(50);   end-ds;
if CAPTUREERROR_00339;
  CAPTUREERROR_00339.F1 = 'within the limit';

and the compile answered RNF7423 (a condition on the structure) and RNF7416 twice (a character store to the
uns(5)), listing sequence 057700, 057800, 058000. It is wrong text with no failure line. Now it is

dcl-ds CAPTUREERROR_00339 qualified;   F0 ind;  G1 char(52);   end-ds;
if CAPTUREERROR_00339.F0;
// SOURCERER-FAIL statement 57700: A339.... (A339.1: a varying-length subfield has no proved length)

The object facts

  • An indicator at byte 0. The test is 33 339; 6 1; 111 5 1; 6 2; 32 339 0 6; 27 K; 7; 16 L with K the compiler's
    '1' (rpg_source_ind.testAtStart). It is the form of rpg_source_ind.subfields with no 27 OFF; 62, because
    the byte is 0. narrowPieces read only 29 and 37 at byte 0, so the load named the whole symbol
    (if STRUCT;).
  • A varying subfield. The statement stores a varying field in two steps (rpg_eval.varying already reads them as
    A339.1 = 'text'): the data copied to the byte after the two length bytes (97 16 3 16 0, no blank fill,
    target byte 3) and, in the same statement, the same count stored as two unsigned bytes (42 339 0 9, byte 1).
    A character field assigned a literal pads with blanks, and an unsigned field is stored in a statement of its
    own. The pair proves the kind (rpg_source_varying.starts). Before, partTypes saw only the 2-byte store and
    typed the byte uns(5).
  • The N of the varchar is not an object fact here. No operation of approveAll holds the 50: a store of a
    literal has no length check, and symbol 339 has no read. The length check of a read (27 MAX; 12; ...; 99 E,
    error 115) holds it, and rpg_eval.varyingCheck accepts it only when MAX is the symbol length less 2, so a
    subfield read is not recognised. The room to the end of the structure (50 here) is a guess in general, so it
    is not emitted.

What the change does

  1. rpg_source_ind.subfields and testAtStart: the byte-0 test above makes byte 0 an ind subfield, and
    narrowPieces names it (STRUCT.F0).
  2. rpg_source_varying.starts: the (symbol, byte) of each varying subfield, true when every access of its two
    length bytes is such an assignment, false when a load or another store of them exists.
  3. rpg_source_varying.typed (used by partReference, paramPart, basedPartOf and the two %SUBST probes):
    such a byte has no type, so the statement that names it is a failure line (with its reason) and the declaration
    keeps the bytes as a filler. No uns(5), no varchar(room).

Measured

  • asyncprom, trunk 84eeba13 (its emit is that of v0.1.508): statements 619, emitted 318, failures 303; with the
    change 619, 316, 305. The two stores (57700, 57900) are failure lines; their old text was RNF7416. The other
    five Async emits are byte-identical. agree.sh: suspect 16, placeholder 10, params_wrong 2 before and after;
    same 227 to 225 and refused 263 to 265 (the two stores); ds_sub_missing 32 to 31, ds_sub_extra 57 to 55.
  • emit-all.sh and emit-diff.sh over 853 programs (the committed twins and the new probe), and
    capture-emit-diff.sh over the 823 public captures: the only emit that differs is that of asyncprom. The 24
    lparm-param-shapes captures are the same.

What the change does not do

  • It does not emit varchar(N). The battery request requests/ldsv/ds-varying (23 cases) asks whether the object
    depends on N (ldsv-n10, ldsv-n50, ldsv-n300, ldsv-tail-split) and where a read holds the MAX (ldsv-read-len,
    ldsv-read-len-split). One line of typed turns the refusal into varchar(room) if the owner accepts the guess.
  • It does not read a varying subfield (%len(d.note), a concatenation), store a variable-length value into one,
    or name a varying subfield of a parameter or a based structure: those statements stay failure lines or keep
    their old text.
  • It does not type the indicator subfields of a based structure (STARTTHREAD_n.F100 = '1' of the Async
    programs stays char(1)), the store of an indicator at byte 0 (d.flag = *on, d.flag = (a > b)), a
    char(1) subfield at byte 0 compared with a literal (the whole structure is still named), or a structure whose
    varchar is at byte 0 with other subfields.
  • It does not change lr1-lv-ds-varying (dcl-s A_00253 varchar(105) for a 107-byte structure of
    varchar(100) and packed(9:0); the MAX of its length check is 100).

Probe and tests

  • Probe ldsv-asyncprom (the public capture of asyncprom, MIT, source and both twins): its matrix row does not
    match and needs a class.
  • src/rpg_ds_varying_test.zig: the emitted declaration and statements of the probe, and the refusals of
    rpg_source_varying.typed.

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)
l10-async-asyncprom base=[619,318,303] head=[619,316,305] CHANGED fail-lines=305
capture-emit-diff: 30 cases, 1 changed, 0 with no failure line in the head emit
allowed: l10-async-asyncprom (lines 578 and 580: the old text stored a string into the uns(5) length of a varchar subfield (RNF7416); the store is refused now)
== e. source agreement (agree)
suspect        base=83 head=83
conflict       base=0 head=0
params_wrong   base=22 head=22
decl_missing   base=87 head=87
decl_extra     base=31 head=31
type_unmarked  base=46 head=46
== f. host round trips (both binaries)
cases to round-trip: 10
lparm-param-shapes/lpar-ar-first                   base=different head=different
lparm-param-shapes/lpar-lk-set-expr                base=different head=different
lparm-param-shapes/lpar-lk-set-local               base=different head=different
lparm-param-shapes/lpar-lk-set-static              base=different head=different
lparm-param-shapes/lpar-pv-copy-val                base=different head=different
lparm-param-shapes/lpar-pv-nop-ref                 base=different head=different
lparm-param-shapes/lpar-pv-nop-val                 base=different head=different
lparm-param-shapes/lpar-pv-ref-int                 base=different head=different
lparm-param-shapes/lpar-pv-val-int                 base=different head=different
lparm-param-shapes/lpar-pv-val-var                 base=different head=different
gate: PASS
# rpg_source.zig: the indicator at byte 0 of a local data structure is a subfield, and a varying-length subfield is a failure line A local data structure declared `likeds(T)` whose template has `approved ind; note varchar(50);` (the public program asyncprom, `decision` of `approveAll`, symbol 339, 53 bytes) was emitted as dcl-ds CAPTUREERROR_00339 qualified; G0 char(1); F1 uns(5); G3 char(50); end-ds; if CAPTUREERROR_00339; CAPTUREERROR_00339.F1 = 'within the limit'; and the compile answered RNF7423 (a condition on the structure) and RNF7416 twice (a character store to the `uns(5)`), listing sequence 057700, 057800, 058000. It is wrong text with no failure line. Now it is dcl-ds CAPTUREERROR_00339 qualified; F0 ind; G1 char(52); end-ds; if CAPTUREERROR_00339.F0; // SOURCERER-FAIL statement 57700: A339.... (A339.1: a varying-length subfield has no proved length) ## The object facts - An indicator at byte 0. The test is `33 339; 6 1; 111 5 1; 6 2; 32 339 0 6; 27 K; 7; 16 L` with K the compiler's '1' (`rpg_source_ind.testAtStart`). It is the form of `rpg_source_ind.subfields` with no `27 OFF; 62`, because the byte is 0. `narrowPieces` read only `29` and `37` at byte 0, so the load named the whole symbol (`if STRUCT;`). - A varying subfield. The statement stores a varying field in two steps (`rpg_eval.varying` already reads them as `A339.1 = 'text'`): the data copied to the byte after the two length bytes (`97 16 3 16 0`, no blank fill, target byte 3) and, in the same statement, the same count stored as two unsigned bytes (`42 339 0 9`, byte 1). A character field assigned a literal pads with blanks, and an unsigned field is stored in a statement of its own. The pair proves the kind (`rpg_source_varying.starts`). Before, `partTypes` saw only the 2-byte store and typed the byte `uns(5)`. - The N of the varchar is not an object fact here. No operation of `approveAll` holds the 50: a store of a literal has no length check, and symbol 339 has no read. The length check of a read (`27 MAX; 12; ...; 99 E`, error 115) holds it, and `rpg_eval.varyingCheck` accepts it only when MAX is the symbol length less 2, so a subfield read is not recognised. The room to the end of the structure (50 here) is a guess in general, so it is not emitted. ## What the change does 1. `rpg_source_ind.subfields` and `testAtStart`: the byte-0 test above makes byte 0 an `ind` subfield, and `narrowPieces` names it (`STRUCT.F0`). 2. `rpg_source_varying.starts`: the (symbol, byte) of each varying subfield, true when every access of its two length bytes is such an assignment, false when a load or another store of them exists. 3. `rpg_source_varying.typed` (used by `partReference`, `paramPart`, `basedPartOf` and the two `%SUBST` probes): such a byte has no type, so the statement that names it is a failure line (with its reason) and the declaration keeps the bytes as a filler. No `uns(5)`, no `varchar(room)`. ## Measured - asyncprom, trunk 84eeba13 (its emit is that of v0.1.508): statements 619, emitted 318, failures 303; with the change 619, 316, 305. The two stores (57700, 57900) are failure lines; their old text was RNF7416. The other five Async emits are byte-identical. `agree.sh`: suspect 16, placeholder 10, params_wrong 2 before and after; same 227 to 225 and refused 263 to 265 (the two stores); ds_sub_missing 32 to 31, ds_sub_extra 57 to 55. - `emit-all.sh` and `emit-diff.sh` over 853 programs (the committed twins and the new probe), and `capture-emit-diff.sh` over the 823 public captures: the only emit that differs is that of asyncprom. The 24 lparm-param-shapes captures are the same. ## What the change does not do - It does not emit `varchar(N)`. The battery request `requests/ldsv/ds-varying` (23 cases) asks whether the object depends on N (ldsv-n10, ldsv-n50, ldsv-n300, ldsv-tail-split) and where a read holds the MAX (ldsv-read-len, ldsv-read-len-split). One line of `typed` turns the refusal into `varchar(room)` if the owner accepts the guess. - It does not read a varying subfield (`%len(d.note)`, a concatenation), store a variable-length value into one, or name a varying subfield of a parameter or a based structure: those statements stay failure lines or keep their old text. - It does not type the indicator subfields of a based structure (`STARTTHREAD_n.F100 = '1'` of the Async programs stays `char(1)`), the store of an indicator at byte 0 (`d.flag = *on`, `d.flag = (a > b)`), a `char(1)` subfield at byte 0 compared with a literal (the whole structure is still named), or a structure whose varchar is at byte 0 with other subfields. - It does not change `lr1-lv-ds-varying` (`dcl-s A_00253 varchar(105)` for a 107-byte structure of `varchar(100)` and `packed(9:0)`; the MAX of its length check is 100). ## Probe and tests - Probe `ldsv-asyncprom` (the public capture of asyncprom, MIT, source and both twins): its matrix row does not match and needs a class. - `src/rpg_ds_varying_test.zig`: the emitted declaration and statements of the probe, and the refusals of `rpg_source_varying.typed`. ## 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) l10-async-asyncprom base=[619,318,303] head=[619,316,305] CHANGED fail-lines=305 capture-emit-diff: 30 cases, 1 changed, 0 with no failure line in the head emit allowed: l10-async-asyncprom (lines 578 and 580: the old text stored a string into the uns(5) length of a varchar subfield (RNF7416); the store is refused now) == e. source agreement (agree) suspect base=83 head=83 conflict base=0 head=0 params_wrong base=22 head=22 decl_missing base=87 head=87 decl_extra base=31 head=31 type_unmarked base=46 head=46 == f. host round trips (both binaries) cases to round-trip: 10 lparm-param-shapes/lpar-ar-first base=different head=different lparm-param-shapes/lpar-lk-set-expr base=different head=different lparm-param-shapes/lpar-lk-set-local base=different head=different lparm-param-shapes/lpar-lk-set-static base=different head=different lparm-param-shapes/lpar-pv-copy-val base=different head=different lparm-param-shapes/lpar-pv-nop-ref base=different head=different lparm-param-shapes/lpar-pv-nop-val base=different head=different lparm-param-shapes/lpar-pv-ref-int base=different head=different lparm-param-shapes/lpar-pv-val-int base=different head=different lparm-param-shapes/lpar-pv-val-var base=different head=different gate: PASS ```
Name the indicator at byte 0 of a data structure and refuse a varying subfield
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
90f501155f
A local structure with `approved ind; note varchar(50);` was emitted as
`G0 char(1); F1 uns(5); G3 char(50);` with `if STRUCT;` and a character
store to the uns(5): RNF7423 and RNF7416 on the recompile.

The compiler's own '1' in a test of byte 0 makes the byte an ind subfield
and names it. The two-step varying assignment (data copied to byte 3, the
same count stored as two unsigned bytes at byte 1) proves a varying field
but not its length N, so the statements that name it are failure lines
and the bytes stay a filler: no uns(5), and no varchar(room) guess.
sean force-pushed ldsv from 90f501155f
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
to a629c853aa
All checks were successful
binjovi/ci Binjovi completed the frozen plan
2026-11-13 14:20:41 +00:00
Compare
binjovi-bot manually merged commit a629c853aa into trunk 2026-11-13 14:30:17 +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!793
No description provided.