Stacked lanes: <> compare of a character parameter, date and time formats, TEST(DE) and TEST(TE) #807

Manually merged
binjovi-bot merged 13 commits from stack-lne-lfmt-ltst-20261115 into trunk 2026-11-16 13:33:56 +00:00
Owner

Stacked lanes: <> compare of a character parameter, date and time formats, TEST(DE) and TEST(TE)

lne

If ( pX <> '*SAME' ) where pX is a char(n) const parameter (the data is at a pointer) and the literal
is shorter than the field compiles to the unit of = with the polarity turned: rpg_value_units.padded
proved only the = form (d7-params: c = 'xyz'), so the <> form kept builtin 17 in the statement and
failed at operation_semantics, op 97. Its IF and the ENDIF of its block failed with it. The unit is now
proved for both polarities, and nothing else about it moved.

dev5/p1 (CHGOBJARG, the four If ( pX <> '*SAME' ) of lines 91, 98, 105 and 111): statements 24;
emitted 10 to 18, failures 14 to 6. The IF of statements 91, 98, 105 and 111 and the ENDIF of 95, 102, 109
and 115 recover, as if V00270 <> '*SAME'; and endif;. The six failures that remain are the two
setup lines (85, 87) and the four changeObjectAttribute(...) / system(...) calls (94, 101, 108, 112),
which are another family.

The battery is requests/lne/padded-ne (19 cases, captures lne-padded-ne, compiled with CRTBNDRPG ... DBGVIEW(*ALL), one case with LICOPT('CodeGenTarget=Power9'), the command of dev5). SC-ILE/EXPERIMENTS holds
lne-p8-eq, -p8-ne, -p10-ne, -p13-ne, -p5-ne, -p8-ne-else (the recovered shapes) and -p8-gt, -p8-ge,
-p8-lt, -p8-le, -p8-and-ne, -p8-rev-ne, -p8-fld-ne (the refused ones). requests/lne/padded-ne2 (3 cases,
captures lne-padded-ne2) adds the padded <> joined to an ordinary compare: SC-ILE/EXPERIMENTS lne2-p8-ne-and-n,
-p8-n-and-ne and -p8-ne-or-n.

The facts, and the probe pairs that decide them

  1. <> is the unit of = with three operations and one constant turned. p8-eq against p8-ne (the
    same program, p = '*SAME' against p <> '*SAME') differ in the compare (7 to 8, twice), in the branch
    after the first N bytes (17 L1 to 16 L1) and in the first result constant (27 0 to 27 1: 1 on the
    first difference). The branch of the second compare (16 L3), its results (1 on the fall-through, 0 at
    L3), the builtin (97 17 3 17 0), the template 32 G N CR and the blanks are the same. p8-eq and
    p10-eq are the = pair of the other width: the shape does not depend on the width.
  2. The width of the field and the padding are not part of the shape. p8-ne (char(8)), p10-ne (char(10),
    the shape of the dev5 diagnosis) and p13-ne (char(13)) have the same operations; only the constants of
    N, the rest and the blanks differ, and the unit reads them as before (rest.operands[1] == N, the blanks
    are blanks).
  3. A field of exactly the length of the literal has no unit. p5-eq and p5-ne (char(5) against the
    5-byte '*SAME') compile to 29 P 0 T; 32 G 0 T; 27 L; 8, which recovered before this change in both
    polarities. They are the control: nothing changed there.
  4. The compile option does not change the shape. p8-ne-p9 (LICOPT('CodeGenTarget=Power9'), the dev5
    command) has the same operations as p8-ne.
  5. An ELSE does not change the unit. p8-ne-else has the same IF, and its ELSE and ENDIF recover with it.
  6. >, >=, < and <= are another shape. p8-gt, -ge, -lt and -le compare the first N
    bytes three ways: 9; 16 L1 for > and >=, 11; 16 L1 for < and <= (the first N bytes decide: 1),
    then 7; 17 L2 (equal: go on to the rest, else 0), then the rest against the blanks with the operator of
    the source (9, 10, 11, 12). That is a template of its own with a different number of operations, not a
    polarity of =; it has no round trip here, so it keeps its failure line (refused, tested) and is the next
    change for this unit.
  7. Two padded compares of one condition share their temporaries. p8-and-ne (p <> '*SAME' and q <> '*ALL') and p8-ne-or reuse the temporaries of the first unit (35 278; 35 279 in both). Both units
    match the template, and each refuses at padded s15 (SOURCERER_TRACE_REFUSALS=1 on this build: two hits in
    each twin), the check that the temporaries appear nowhere else in the body (private), as for =. So
    both keep their failure line. paddedFields asks only that the code after never reads them before it
    writes them (local); that weaker proof is a next change for padded, for both polarities.
  8. A padded <> joined to an ordinary compare reads as the = form does. lne2-p8-ne-and-n
    (p <> '*SAME' and n > 3), -p8-n-and-ne (n > 3 and p <> '*SAME') and -p8-ne-or-n (or) have one padded
    unit each, so private holds; the unit leaves its value B where the = unit of d7-params leaves it, and the
    AND and OR read B. They recover (7 of 7, no failure line; before 5 of 7) and round-trip (below).
  9. A literal on the left and a field against a parameter are other shapes, for = as well. p8-rev-eq
    and -rev-ne ('*SAME' = p) load the literal after the pointer behind a swap (1); p8-fld-eq and
    -fld-ne (p = s, s char(5)) load the short field with 34 s 0; 113 and the long one at a pointer with
    29 P 0 T; 113, which paddedFields (two 34 heads) does not read. None of the four recovered before
    and none does now.

What changed

  • rpg_value_units.padded takes the polarity: paddedEq and paddedNe are two rules of the chain, each with
    its own operations template (padded_eq_ops, padded_ne_ops); the first result constant is the only
    other difference. Every other check, the temporaries, the labels and the replacement (29 P 0 T; 32 G 0 T; 33 L; C; 35 B, C the compare of the unit) are shared. A unit that mixes the two refuses (each half is
    matched against one template).
  • rpg_padded_ne_test.zig (8 tests): the statement text of the four twins; the emitted IF, ELSE and ENDIF
    with no failure line; the padded <> under AND and OR next to an ordinary compare; the = and unpadded <> forms as before; the refusal of >, >=, <, <=, of the
    AND, of the literal on the left and of the field against a parameter; the replacement itself; each operation
    and operand of the unit changed, and a mixed polarity.

Measured

program emitted failures
dev5/p1 (v0.1.522 to this build) 10 to 18 14 to 6
lne-p8-ne, -p10-ne, -p13-ne, -p8-ne-p9 (7 statements) 5 to 7 2 to 0
lne-p8-ne-else (9 statements) 6 to 9 3 to 0
lne2-p8-ne-and-n, -p8-n-and-ne, -p8-ne-or-n (7 statements) 5 to 7 2 to 0
the other 14 cases of the battery equal, byte for byte equal

capture-emit-diff.sh over the 1108 public captures that have a stripped twin (captures/*/*, base v0.1.522
against this build): 6 change (dev5/p1 and lne-p8-ne, -p10-ne, -p13-ne, -p8-ne-p9, -p8-ne-else); the
other 1102 emit byte for byte as before. The unit fires nowhere else in the public corpus.

The round trip (host, pub400, pub-roundtrip.sh with the build of this change)

The emit of each recovered twin is compiled with the command of the capture and compared with the original object.

twin shape verdict
lne-p10-ne if p <> '*SAME', p char(10) const match
lne-p13-ne the same with char(13) match
lne-p8-ne the same with char(8) match
lne-p8-ne-else with an ELSE match
lne2-p8-ne-and-n p <> '*SAME' and n > 3 match
lne2-p8-n-and-ne n > 3 and p <> '*SAME' match
lne2-p8-ne-or-n p <> '*SAME' or n > 3 match

match is the verdict with only the compilation time differing. The refused twins have no round trip: their
emit keeps a failure line. dev5/p1 itself has six failure lines left (the calls) and does not compile whole.

The refused cases (p8-gt, -ge, -lt, -le, -and-ne, -ne-or, -rev-eq, -rev-ne, -fld-eq,
-fld-ne) emit the same text as before: the change only takes failure lines away.

lfmt

The format table of the date run time (rpg_date_convert.formats) had no row for three descriptors that
the compiler writes for %DATE(x: fmt) and %TIME(x: fmt). The source descriptor of _QRNX_DT_CVT then
named no measured format, date_convert.recover returned null and rpg_eval.dateConvertCall failed at
s02 (stage call, missing=operation_semantics). Three rows are added, each from the descriptor
literal of one capture:

keyword kind id length separator probes
*DMY0 1 date 24 6 FF lfmt-d01; digits lfmt-d07, -d09, -d10; %CHAR target lfmt-g01
*EUR0 1 date 5 8 FF lfmt-d05; digits lfmt-d11; %CHAR target lfmt-g03
*HMS0 2 time 27 6 FF lfmt-t01; digits lfmt-t03

The same change closes a wrong emit that trunk has for the 0 rows it already holds: a source that the
statement assembled in a temporary (%date(a + b: *iso0)) was written as its first piece alone
(%DATE(A_00253)), and the new rows would have repeated it. recover now refuses that source (fact 10).

The facts, and the probe pairs that decide them

The battery is requests/lfmt/dt-formats (22 probes, captures lfmt-dt-formats; 21 captured). Each
descriptor below is the literal S62 (the source) or S63 (the target) of the observable twin's
statements.rpgle. The twins are committed as SC-ILE/EXPERIMENTS/lfmt-*.

  1. *DMY0 is id 24, 6 bytes, separator FF. lfmt-d01 (%date(c6: *dmy0)) against lfmt-d02
    (%date(c6: *ymd0), the known row): X'0001001800000006FF..' against X'0001001900000006FF..', the id
    is the only difference.
  2. Digits read as *DMY carry the descriptor of the 0 form. %date(n6: *dmy) with packed(6)
    (lfmt-d07), int(10) (-d09) and zoned(6) (-d10) write X'0001001800000006FF..', the same
    bytes as lfmt-d01. The compiler copies the number into a temporary first (S307 = S259), and
    rpg_eval.dateConvertCall reads that saved temporary: the format is the keyword without its last 0
    (s07). lfmt-d08 (%date(n8: *iso), the known *ISO0 row) is the pair.
  3. *EUR0 is id 5, 8 bytes, separator FF. lfmt-d05 against lfmt-d06 (*iso0, id 3):
    X'0001000500000008FF..' against X'0001000300000008FF..'. %date(n8: *eur) (lfmt-d11) writes the
    same bytes as lfmt-d05.
  4. *HMS0 is kind 2, id 27, 6 bytes, separator FF. lfmt-t01 (%time(c6: *hms0)) against lfmt-t02
    (%time(c8: *hms:), the known *HMS row, separator 7A): X'0002001B00000006FF..' against
    X'0002001B000000087A..'. %time(n6: *hms) (lfmt-t03) writes the bytes of lfmt-t01.
  5. The default formats of the module do not change the source descriptor. lfmt-e01, -e02, -e03 (the
    program's header ctl-opt datfmt(*eur) timfmt(*hms:)) have the descriptors of lfmt-d01, -d05, -t01.
    The target field is then date(*eur) (lfmt-e01, -e02).
  6. %CHAR(d: fmt) writes the same descriptors as its target (S63 of lfmt-g01, -g02, -g03):
    *DMY0, *DMY& and *EUR0. The source of those three is the *ISO date with the separator -
    (X'000100030000000A60..').
  7. *DMY& is id 24, 8 bytes, separator 40 (lfmt-d03 against lfmt-d04, *dmy, separator 61). It is
    measured and not a row (below).
  8. %time(n6: *iso) is kind 2, id 4, 6 bytes, separator FF (lfmt-t04). It is another descriptor,
    not a row: no dev5 statement needs it, and whether its id follows the module's timfmt was not measured.
  9. %CHAR(t: *HMS0) writes the *HMS0 descriptor as its target (lfmt-g04, recaptured with
    t'08.00.00': the first attempt wrote t'08:00:00', which is no *ISO time literal, RNF0306): S63 is
    X'0002001B00000006FF..', the source the *ISO time with the separator . (X'00020004000000084B..').
  10. A source that the statement assembled in a temporary is not the digits of a field. %date(a + b: *iso0)
    (lfmt-x06) and %date(a + b: *ymd0) (-x07) are two stores into one 8- or 6-byte temporary, and trunk
    (v0.1.522) emits A_00255 = %DATE(A_00253); and A_00255 = %DATE(A_00253: *YMD);: the first piece
    alone, and the keyword of the digits form. That is a wrong emit that exists at trunk for the rows
    *ISO0, *YMD0 (and *USA0); with the new rows it would reach *DMY0 and *EUR0 too (lfmt-x01,
    -x04 emit %DATE(A_00253: *DMY), %DATE(A_00253: *EUR)). rpg_eval.dateConvertCall reads the saved
    temporary at byte 0 and takes it for the digits of a number (s07, the keyword minus its 0); it does
    not check the width of the saved value against the descriptor.

What recovers

  • lfmt-d01, -d05, -d07, -d09, -d10, -d11, -e01, -e02, -t03, -g01, -g03 emit with no
    failure line (16 of the 21 probes of the first battery failed at trunk; 11 recover, and 5 keep a failure line:
    lfmt-d03, -g02, -e03, -t01, -t04, below). Examples: A_00254 = %DATE(A_00253: *DMY0);,
    A_00254 = %DATE(A_00253: *EUR0);, A_00253 = %DATE(A_00254: *DMY);, A_00254 = %TIME(A_00253: *HMS);,
    A_00253 = %CHAR(A_00254: *DMY0);.
  • dev5/p2 (PF751FB55S, measured with the host Debug build of this change against the host Debug build of trunk
    fdb37831): statements 75, emitted 31, failures 44 becomes emitted 37, failures 38. Statements 52
    (%Date(Date_Char6:*dmy0)), 68 and 78 (%Date(Date_Char8:*eur0)), 90 (%Date(Date_Num6:*dmy)), 164 and
    173 (%Time(Time_Num6:*hms)) recover. Statements 60 and 144 are still failure lines (below). The
    failure lines of the TEST(DE) / IF NOT %ERROR / ENDIF blocks around them (groups of the statements
    50, 51, 53 and their kin) are other causes and are unchanged.

What is refused, and why

rpg_date_convert.recover refuses a source of characters with no separator (FF) in an automatic storage that
the statement itself addressed, read or stored into before the call, unless the number was saved with its own
type word (113 q 1). lfmt-x01, -x04, -x06 and -x07 now keep a failure line instead of a wrong emit; the
last two are the rows *ISO0 and *YMD0 of trunk, whose wrong emit this removes. A substring as the source
(lfmt-x02, -x03, -x05) failed at trunk and still does.

Two statements of the family keep a failure line. Each needs an edit in rpg_source_stmt.zig or
rpg_source.zig, which another lane owns, so they are reported, not changed:

  • Characters read as *HMS0 (lfmt-t01, -e03; p2 statement 144 %Time(Time_Char6:*hms0)) and
    %CHAR(t: *HMS0) (lfmt-g04). The row is here and the call is proved (S254.0 = %TIME(S253: *HMS0)), but
    rpg_source_stmt.date_formats (lines 434-438, read by rpg_source.keyword) has no *HMS0. Adding that one
    word recovers lfmt-t01 and -e03 (tried on this tree and reverted): A_00254 = %TIME(A_00253: *HMS0);. The
    same word would let %CHAR(t: *HMS0) through; lfmt-g04 proves its descriptor but its emit has no round trip.
  • *DMY& (lfmt-d03, -g02; p2 statement 60 %Date(Date_Char8:*dmy&)). The descriptor is measured but
    no row is written: the emit could not read it back. runtimeSummary refuses a keyword that is not
    alphanumeric (rpg_source_stmt.zig:225, site s11), date_formats has no *DMY&, and with those two
    edits tried the failure moves to rpg_source.translate s06 on S254.0 = %DATE(S253: *DMY&): the
    expression reader does not take & as part of a word. A third site, not located. When that lane
    lands the three edits, the row to add is .{ .id = 24, .length = 8, .separator = 0x40, .keyword = "*DMY&" }.
  • Digits read as *ISO time (lfmt-t04, fact 8) keep their failure line: no row.
  • lfmt-d07, -d10, -d11 and -t03 carry SOURCERER-TODO decimal_positions: not proved, 0 assumed
    on the number field (a placeholder, as lfmt-d08 does at trunk): a packed or zoned source has no
    proved decimal positions. Not changed.
  • Not probed, so refused: a numeric expression or function result as the source (%date(n + 1: *dmy),
    %date(%abs(n): *dmy)), which also reaches dateConvertCall as a saved temporary. savedNumber accepts
    only the three captured chains of a whole packed, zoned or int(10) field before the 33 S store.

Tests

src/rpg_lfmt_test.zig: the three rows and their numeric and %CHAR uses, the neighbours that must
not change (lfmt-d02, -d04, -d06, -d08, -t02), the refusal of every twin that keeps a failure line
(lfmt-t04, -t01, -e03, -d03, -g02, -g04, the substring sources -x02, -x03, -x05 and the
concatenated sources -x01, -x04, -x06, -x07), and the table (each row once; no row of the same id with a
length or a separator that no probe shows). The tests that pin a refusal waiting for the other lane (-t01, -e03,
-d03, -g02, -g04) become recovers lines when that lane lands its edit. Run red before each change:
with the three rows absent the four recovers tests and the table test failed (first run, with four rows); with the
rows and no guard the concatenation test failed (lfmt-x01 wrote %DATE(A_00253: *DMY)); all pass with both.

For the matrix

Round trip on pub400 of the emitted source of the stripped twin (roundtrip.sh, run rt1, the build of the
rows before the guard, which writes the same text for these twins): lfmt-d01, -d05, -d07, -d09, -d10,
-d11, -e01, -e02, -t03, -g01 and -g03 all match (only compilation differs).
lfmt-d02, -d04, -d06, -d08 and -t02 (trunk's own rows) were not round-tripped by this change. The twins
that keep a failure line (lfmt-d03, -e03, -g02, -g04, -t01, -t04 and the seven -x twins) cannot
match and need a class row (known_gap, the reason in this fragment).

ltst

test(de) *dmy0 c, test(te) *hms n and the if not %error after them failed twice. The TEST compiles
to a call of _QRNX_DT_CHK that no reader knew, so the statement kept only its plumbing (S253 = '0',
the descriptor stores). The (E) extender writes a one-byte flag that IF %ERROR reads, and that flag
(0x70008000, a field of the compiler) had a %ERROR role for file operations only, so the IF failed
with "no declaration of symbol", and each ENDIF of such a block with "its block is not whole". This
change reads the whole TEST block as the statement (rpg_test_op.zig), names the flag %ERROR
(rpg_file_ops.zig, flagNames) and lets %ERROR stand without a file (rpg_source_files.zig, bif: only
when a TEST is proved, and never beside a file declaration that failed).
dev5/p2 goes from 44 failure lines (31 statements emitted of 75) to 14 (61 emitted): the 10 TESTs, the
10 IFs and the 10 ENDIFs of the 30 lines recover. The 14 are other families (below).

The battery is requests/ltst/test-error (28 cases, captures ltst-test-error; -c02 is dropped by the
compiler, the other 27 are captured, 25 are committed as SC-ILE/EXPERIMENTS ltst-c01 to ltst-f15;
-c07 and -c12 stay in the data) and test-error2 (ltst-f16, -f17, committed; -d01 and -d02 are
dropped by the compiler, RNF7523). The test file is src/rpg_test_op_test.zig.

The facts, and the probe pairs that decide them

  1. A TEST(DE) or TEST(TE) is one block with one call. ltst-c01 (test(de) *dmy0 c, c a char(6))
    has: 27 0; 35 S54, the address of the field into the descriptor (34 F 0; 37 DS 16), the 16 bytes of
    the format at DS+0 (27 K; 37 DS 0), 8 zero bytes as the options (27 Z; 35 O), the call
    99 _QRNX_DT_CHK 2 0 0 with the addresses of DS and O, and a compare of the first 4 bytes of O with
    0. The same block is statement 50 of dev5/p2. A return of 0 jumps to the label that ends the
    statement; anything else runs the error path, which writes the program status: the status moves
    from PSDS+10 to PSDS+15, the statement number goes to PSDS+20 as eight zoned digits (it equals the
    number of the statement in the 110 operation: 3 in -c01, 50 in p2), and the return code goes to
    PSDS+10 as five zoned digits. A TEST(D) and a TEST(T) differ in the kind byte of the format.
  2. The flag exists only when the program reads %ERROR. -c01 against -c04 (c01 plus
    if not %error; n = 1; endif) differ in two stores (diffed on the raw operations): 27 '0'; 35 F
    at the start of the statement and 27 '1'; 35 F at the start of the error path. A TEST whose %ERROR
    no statement reads has neither (-c01, -c03, -f01 to -f17), and is the same text.
  3. A free-form test(d) with neither the extender nor an indicator does not compile. -c02
    (test(d) *dmy0 c) is dropped by the capture (compile message RNF5056; the text of the message was not
    read). So each twin has the extender, and the emit writes (de) or (te). The fixed-form form with an ER
    indicator has no twin and is not read.
  4. IF NOT %ERROR and IF %ERROR differ in the comparison only. -c04 against -c05: the
    condition reads NOT (F = '1') against (F = '1'). These statements were recovered at the
    statements layer before this change; the failure was the declaration of F, a flag of the compiler,
    which a source cannot hold. Once F is %ERROR the text has no field of the compiler.
  5. One flag serves every (E) operation of the module. -c06 (two TESTs, two IFs) has one
    flag. -c08 (test(de), callp(e) w(), if %error): the CALLP(E) writes '0' into the symbol
    that the TEST writes. The flag is therefore %ERROR without a file, as the file operations name it;
    flagNames names it when every other write is a store of '0' or '1' (exclusive). The CALLP(E)
    itself has no rule (-c07: S253 = '0'; S54 = 0 then the call, and the IF fails on the flag): a
    separate family, and it stays a failure line (-c08 keeps exactly that one).
  6. The format is the descriptor of factor 1. -c13 has ctl-opt datfmt(*eur) timfmt(*hms:) and
    test(de) *eur0 c: the descriptor equals -f02 (*eur0 without the header). The header does not
    enter. -c11 (a TEST in a procedure) is the same block with the same flag and program status; its field c
    is still a global dcl-s, so only the TEST sits in the procedure. Every twin tests a static global field
    (class 3, no owner) and the reader requires exactly that: an automatic field (class 4), a parameter (class 5)
    and a static field that a procedure owns refuse (staticField; the mutation test is in
    src/rpg_test_op_test.zig). Every refusal test asserts the emit as well as the proof: the statement stays a
    SOURCERER-FAIL line, with no test( line and no %ERROR.
  7. A number has the descriptor of the 0 form of its format. -f03 (test(de) *dmy n, n
    packed(6:0)) and -c01 (*dmy0, char(6)) have the same descriptor constant (date, id 24,
    length 6, separator FF). A packed number is copied to a zoned temporary first (29 N 0 T; 85 D 1; 35 Z; 34 Z 0), a zoned number is read in place (-f15, 34 N 0). The packed numbers that a twin shows
    are *dmy of a packed(6:0) (-f03), *iso of a packed(8:0) (-f04) and *hms of a packed(6:0)
    (-f06, -c10, p2 statements 162 and 171); the zoned numbers are a *dmy of a zoned(6:0)
    (-f15) and a *hms of a zoned(6:0) (-f17). rows has one cell for each of these, and the other
    cells stay empty. The reader takes a
    number only when its digits are the length of the format.
  8. *hms: and *hms are one descriptor. -f05 (*hms:) and -f14 (*hms), both on a char(8): the
    same format (time, id 27, length 8, separator 7A, the colon). The emit writes *hms.

The formats that a twin shows are in rows of rpg_test_op.zig, each with its descriptor: date *DMY0
(24, 6, FF), *DMY& (24, 8, 40), *EUR0 (5, 8, FF), *ISO (3, 10, 60), *USA
(1, 10, 61), *MDY (23, 8, 61), *YMD (25, 8, 61), *EUR (5, 10, 4B), *JUL (26, 6, 61); a number *DMY (24, 6, FF), *ISO (3, 8, FF) and *HMS (27, 6, FF); time *HMS0
(27, 6, FF), *HMS (27, 8, 7A), *ISO (4, 8, 4B). The descriptors are the measured ones of
rpg_date_convert.zig where that file has the same format; this change does not read that table (the
other lanes extend it) and does not edit it.

What recovers

  • Battery cases (before is v0.1.522, after is this change): -c01, -c03, -c04, -c05, -c06, -c09,
    -c10, -c11, -c13, -f01 to -f17: before, a failure line for the TEST (and for the IF and the
    ENDIF where there are some); after, none. -c08 keeps one failure line, the CALLP(E).
  • dev5/p2: statements 50, 58, 66, 76, 88, 96, 142, 150, 162 and 171 (the TESTs), 51, 59, 67, 77, 89, 97,
    143, 151, 163 and 172 (the IFs), 53, 61, 69, 79, 91, 99, 145, 153, 165 and 174 (the ENDIFs); emitted 31 to
    61 of 75, failure lines 44 to 14. Statements 98 and 152 now sit in their block (if NOT %ERROR; A = %DATE(...); endif;).

Not done, and why

  • A TEST of a date or time field (test(de) d, no factor 1): its descriptor is the native one, with the
    separator byte 0 (rpg_date_convert.zig), and no row of this change has that byte, so the statement refuses.
    Its twin would be -d01 (test(de) d, a date(*iso)) and -d02 (test(te) t, a time(*iso)): the compiler
    dropped both (RNF7523; the message text was not read), so the claim rests on the native descriptors of
    rpg_date_convert.zig, not on a TEST twin.
  • A TEST with another format (a character field with *DMY and its slash, *USA0, *JIS, *CYMD, a
    timestamp TEST(Z), an ER indicator form, an array element, a subfield, a varying field, a field local to a
    procedure, a parameter): no twin, no
    row, the statement stays a failure line. Each format is one row and one twin.
  • The decimal positions of a number that a TEST names are not read from the object: it holds none, and
    the language requires 0, so the declaration has 0 and the SOURCERER-TODO decimal_positions placeholder
    stays (-c10, -f03, -f04, -f06, -f15, -f17).
  • The 14 failure lines left in p2 are not this family. Statements 52, 60, 68, 78, 90, 144, 164 and 173
    (the %DATE(c: *dmy0) and %TIME(c: *hms0) after a TEST) are rpg_date_convert.zig and need its format
    rows for the descriptors above that it lacks (*DMY0, *DMY&, *EUR0, *HMS0) and for a number as
    the source (S307 = S259 first). Statements 170, 208, 214, 215, 220 and 221 are the time and
    multiplication families.
  • CALLP(E) and every other (E) operation that is not a file operation or a TEST: -c07, and the flag
    store of -c08.

For the matrix

ltst-c01 to -f17 except -c08 have no failure line and are for the round trip; -c08 keeps the
CALLP(E) failure line and needs a class row (known_gap, the reason in this fragment).

Gate

== a. development emits (dev-hash)
p1 DIFFERENT
p2 DIFFERENT
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)
p1 base=[24,10,14] head=[24,18,6] CHANGED fail-lines=6
p2 base=[75,31,44] head=[75,67,8] CHANGED fail-lines=8
lfmt-d01-dmy0-c6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-d05-eur0-c8 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-d07-dmy-n6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-d09-dmy-i6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-d10-dmy-z6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-d11-eur-n8 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-e01-dmy0-eurhdr base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-e02-eur0-eurhdr base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-e03-hms0-hmshdr base=[2,1,1] head=[2,1,1] CHANGED fail-lines=1
lfmt-g01-char-dmy0 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-g03-char-eur0 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-t01-hms0-c6 base=[2,1,1] head=[2,1,1] CHANGED fail-lines=1
lfmt-t03-hms-n6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lfmt-g04-char-hms0 base=[2,1,1] head=[2,1,1] CHANGED fail-lines=1
lfmt-x06-cat-iso0 base=[2,2,0] head=[2,1,1] CHANGED fail-lines=1
lfmt-x07-cat-ymd0 base=[2,2,0] head=[2,1,1] CHANGED fail-lines=1
lne-p10-ne base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0
lne-p13-ne base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0
lne-p8-ne-else base=[9,6,3] head=[9,9,0] CHANGED fail-lines=0
lne-p8-ne-p9 base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0
lne-p8-ne base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0
lne2-p8-n-and-ne base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0
lne2-p8-ne-and-n base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0
lne2-p8-ne-or-n base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0
ltst-c01-de-dmy0 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
ltst-c03-te-hms0 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
ltst-c04-ifnot base=[5,2,3] head=[5,5,0] CHANGED fail-lines=0
... 90 lines omitted; the full table is in gate.log ...
lne-padded-ne/lne-p10-ne                           base=different head=match
lne-padded-ne/lne-p13-ne                           base=different head=match
lne-padded-ne/lne-p5-eq                            base=match head=match
lne-padded-ne/lne-p5-ne                            base=match head=match
lne-padded-ne/lne-p8-eq                            base=match head=match
lne-padded-ne/lne-p8-ne-else                       base=different head=match
lne-padded-ne/lne-p8-ne-p9                         base=different head=match
lne-padded-ne/lne-p8-ne                            base=different head=match
lne-padded-ne2/lne2-p8-n-and-ne                    base=different head=match
lne-padded-ne2/lne2-p8-ne-and-n                    base=different head=match
lne-padded-ne2/lne2-p8-ne-or-n                     base=different head=match
ltst-test-error/ltst-c01-de-dmy0                   base=different head=match
ltst-test-error/ltst-c03-te-hms0                   base=different head=match
ltst-test-error/ltst-c04-ifnot                     base=different head=match
ltst-test-error/ltst-c05-if                        base=different head=match
ltst-test-error/ltst-c06-two                       base=different head=match
ltst-test-error/ltst-c09-ifnot-time                base=different head=match
ltst-test-error/ltst-c10-num-time                  base=different head=match
ltst-test-error/ltst-c11-proc                      base=different head=match
ltst-test-error/ltst-c12-assign                    base=match head=match
ltst-test-error/ltst-c13-header                    base=different head=match
ltst-test-error/ltst-f01-dmy-amp                   base=different head=match
ltst-test-error/ltst-f02-eur0                      base=different head=match
ltst-test-error/ltst-f03-dmy-p6                    base=different head=match
ltst-test-error/ltst-f04-iso-p8                    base=different head=match
ltst-test-error/ltst-f05-hms-colon                 base=different head=match
ltst-test-error/ltst-f06-hms-p6                    base=different head=match
ltst-test-error/ltst-f07-iso                       base=different head=match
ltst-test-error/ltst-f08-usa                       base=different head=match
ltst-test-error/ltst-f09-mdy                       base=different head=match
ltst-test-error/ltst-f10-ymd                       base=different head=match
ltst-test-error/ltst-f11-eur                       base=different head=match
ltst-test-error/ltst-f12-jul                       base=different head=match
ltst-test-error/ltst-f13-time-iso                  base=different head=match
ltst-test-error/ltst-f14-time-hms                  base=different head=match
ltst-test-error/ltst-f15-dmy-z6                    base=different head=match
ltst-test-error2/ltst-f16-iso0                     base=different head=match
ltst-test-error2/ltst-f17-hms-z6                   base=different head=match
gate: PASS
# Stacked lanes: <> compare of a character parameter, date and time formats, TEST(DE) and TEST(TE) ## lne `If ( pX <> '*SAME' )` where `pX` is a `char(n) const` parameter (the data is at a pointer) and the literal is shorter than the field compiles to the unit of `=` with the polarity turned: `rpg_value_units.padded` proved only the `=` form (`d7-params`: `c = 'xyz'`), so the `<>` form kept builtin 17 in the statement and failed at `operation_semantics`, op 97. Its IF and the ENDIF of its block failed with it. The unit is now proved for both polarities, and nothing else about it moved. dev5/p1 (`CHGOBJARG`, the four `If ( pX <> '*SAME' )` of lines 91, 98, 105 and 111): statements 24; emitted 10 to 18, failures 14 to 6. The IF of statements 91, 98, 105 and 111 and the ENDIF of 95, 102, 109 and 115 recover, as `if V00270 <> '*SAME';` and `endif;`. The six failures that remain are the two setup lines (85, 87) and the four `changeObjectAttribute(...)` / `system(...)` calls (94, 101, 108, 112), which are another family. The battery is `requests/lne/padded-ne` (19 cases, captures `lne-padded-ne`, compiled with `CRTBNDRPG ... DBGVIEW(*ALL)`, one case with `LICOPT('CodeGenTarget=Power9')`, the command of dev5). SC-ILE/EXPERIMENTS holds `lne-p8-eq`, `-p8-ne`, `-p10-ne`, `-p13-ne`, `-p5-ne`, `-p8-ne-else` (the recovered shapes) and `-p8-gt`, `-p8-ge`, `-p8-lt`, `-p8-le`, `-p8-and-ne`, `-p8-rev-ne`, `-p8-fld-ne` (the refused ones). `requests/lne/padded-ne2` (3 cases, captures `lne-padded-ne2`) adds the padded `<>` joined to an ordinary compare: SC-ILE/EXPERIMENTS `lne2-p8-ne-and-n`, `-p8-n-and-ne` and `-p8-ne-or-n`. ## The facts, and the probe pairs that decide them 1. **`<>` is the unit of `=` with three operations and one constant turned.** `p8-eq` against `p8-ne` (the same program, `p = '*SAME'` against `p <> '*SAME'`) differ in the compare (`7` to `8`, twice), in the branch after the first N bytes (`17 L1` to `16 L1`) and in the first result constant (`27 0` to `27 1`: 1 on the first difference). The branch of the second compare (`16 L3`), its results (1 on the fall-through, 0 at L3), the builtin (`97 17 3 17 0`), the template `32 G N CR` and the blanks are the same. `p8-eq` and `p10-eq` are the `=` pair of the other width: the shape does not depend on the width. 2. **The width of the field and the padding are not part of the shape.** `p8-ne` (char(8)), `p10-ne` (char(10), the shape of the dev5 diagnosis) and `p13-ne` (char(13)) have the same operations; only the constants of N, the rest and the blanks differ, and the unit reads them as before (`rest.operands[1] == N`, the blanks are blanks). 3. **A field of exactly the length of the literal has no unit.** `p5-eq` and `p5-ne` (char(5) against the 5-byte `'*SAME'`) compile to `29 P 0 T; 32 G 0 T; 27 L; 8`, which recovered before this change in both polarities. They are the control: nothing changed there. 4. **The compile option does not change the shape.** `p8-ne-p9` (`LICOPT('CodeGenTarget=Power9')`, the dev5 command) has the same operations as `p8-ne`. 5. **An ELSE does not change the unit.** `p8-ne-else` has the same IF, and its ELSE and ENDIF recover with it. 6. **`>`, `>=`, `<` and `<=` are another shape.** `p8-gt`, `-ge`, `-lt` and `-le` compare the first N bytes three ways: `9; 16 L1` for `>` and `>=`, `11; 16 L1` for `<` and `<=` (the first N bytes decide: 1), then `7; 17 L2` (equal: go on to the rest, else 0), then the rest against the blanks with the operator of the source (9, 10, 11, 12). That is a template of its own with a different number of operations, not a polarity of `=`; it has no round trip here, so it keeps its failure line (refused, tested) and is the next change for this unit. 7. **Two padded compares of one condition share their temporaries.** `p8-and-ne` (`p <> '*SAME' and q <> '*ALL'`) and `p8-ne-or` reuse the temporaries of the first unit (`35 278; 35 279` in both). Both units match the template, and each refuses at `padded s15` (SOURCERER_TRACE_REFUSALS=1 on this build: two hits in each twin), the check that the temporaries appear nowhere else in the body (`private`), as for `=`. So both keep their failure line. `paddedFields` asks only that the code after never reads them before it writes them (`local`); that weaker proof is a next change for `padded`, for both polarities. 8. **A padded `<>` joined to an ordinary compare reads as the `=` form does.** `lne2-p8-ne-and-n` (`p <> '*SAME' and n > 3`), `-p8-n-and-ne` (`n > 3 and p <> '*SAME'`) and `-p8-ne-or-n` (`or`) have one padded unit each, so `private` holds; the unit leaves its value B where the `=` unit of `d7-params` leaves it, and the AND and OR read B. They recover (7 of 7, no failure line; before 5 of 7) and round-trip (below). 9. **A literal on the left and a field against a parameter are other shapes, for `=` as well.** `p8-rev-eq` and `-rev-ne` (`'*SAME' = p`) load the literal after the pointer behind a swap (`1`); `p8-fld-eq` and `-fld-ne` (`p = s`, `s char(5)`) load the short field with `34 s 0; 113` and the long one at a pointer with `29 P 0 T; 113`, which `paddedFields` (two `34` heads) does not read. None of the four recovered before and none does now. ## What changed - `rpg_value_units.padded` takes the polarity: `paddedEq` and `paddedNe` are two rules of the chain, each with its own operations template (`padded_eq_ops`, `padded_ne_ops`); the first result constant is the only other difference. Every other check, the temporaries, the labels and the replacement (`29 P 0 T; 32 G 0 T; 33 L; C; 35 B`, C the compare of the unit) are shared. A unit that mixes the two refuses (each half is matched against one template). - `rpg_padded_ne_test.zig` (8 tests): the statement text of the four twins; the emitted IF, ELSE and ENDIF with no failure line; the padded `<>` under AND and OR next to an ordinary compare; the `=` and unpadded `<>` forms as before; the refusal of `>`, `>=`, `<`, `<=`, of the AND, of the literal on the left and of the field against a parameter; the replacement itself; each operation and operand of the unit changed, and a mixed polarity. ## Measured | program | emitted | failures | |---|---|---| | dev5/p1 (v0.1.522 to this build) | 10 to 18 | 14 to 6 | | `lne-p8-ne`, `-p10-ne`, `-p13-ne`, `-p8-ne-p9` (7 statements) | 5 to 7 | 2 to 0 | | `lne-p8-ne-else` (9 statements) | 6 to 9 | 3 to 0 | | `lne2-p8-ne-and-n`, `-p8-n-and-ne`, `-p8-ne-or-n` (7 statements) | 5 to 7 | 2 to 0 | | the other 14 cases of the battery | equal, byte for byte | equal | `capture-emit-diff.sh` over the 1108 public captures that have a stripped twin (`captures/*/*`, base v0.1.522 against this build): 6 change (dev5/p1 and `lne-p8-ne`, `-p10-ne`, `-p13-ne`, `-p8-ne-p9`, `-p8-ne-else`); the other 1102 emit byte for byte as before. The unit fires nowhere else in the public corpus. ## The round trip (host, pub400, `pub-roundtrip.sh` with the build of this change) The emit of each recovered twin is compiled with the command of the capture and compared with the original object. | twin | shape | verdict | |---|---|---| | `lne-p10-ne` | `if p <> '*SAME'`, `p char(10) const` | match | | `lne-p13-ne` | the same with `char(13)` | match | | `lne-p8-ne` | the same with `char(8)` | match | | `lne-p8-ne-else` | with an ELSE | match | | `lne2-p8-ne-and-n` | `p <> '*SAME' and n > 3` | match | | `lne2-p8-n-and-ne` | `n > 3 and p <> '*SAME'` | match | | `lne2-p8-ne-or-n` | `p <> '*SAME' or n > 3` | match | `match` is the verdict with only the compilation time differing. The refused twins have no round trip: their emit keeps a failure line. dev5/p1 itself has six failure lines left (the calls) and does not compile whole. The refused cases (`p8-gt`, `-ge`, `-lt`, `-le`, `-and-ne`, `-ne-or`, `-rev-eq`, `-rev-ne`, `-fld-eq`, `-fld-ne`) emit the same text as before: the change only takes failure lines away. ## lfmt The format table of the date run time (`rpg_date_convert.formats`) had no row for three descriptors that the compiler writes for `%DATE(x: fmt)` and `%TIME(x: fmt)`. The source descriptor of `_QRNX_DT_CVT` then named no measured format, `date_convert.recover` returned null and `rpg_eval.dateConvertCall` failed at `s02` (stage `call`, `missing=operation_semantics`). Three rows are added, each from the descriptor literal of one capture: | keyword | kind | id | length | separator | probes | |---|---|---|---|---|---| | `*DMY0` | 1 date | 24 | 6 | `FF` | `lfmt-d01`; digits `lfmt-d07`, `-d09`, `-d10`; `%CHAR` target `lfmt-g01` | | `*EUR0` | 1 date | 5 | 8 | `FF` | `lfmt-d05`; digits `lfmt-d11`; `%CHAR` target `lfmt-g03` | | `*HMS0` | 2 time | 27 | 6 | `FF` | `lfmt-t01`; digits `lfmt-t03` | The same change closes a wrong emit that trunk has for the `0` rows it already holds: a source that the statement assembled in a temporary (`%date(a + b: *iso0)`) was written as its first piece alone (`%DATE(A_00253)`), and the new rows would have repeated it. `recover` now refuses that source (fact 10). ## The facts, and the probe pairs that decide them The battery is `requests/lfmt/dt-formats` (22 probes, captures `lfmt-dt-formats`; 21 captured). Each descriptor below is the literal `S62` (the source) or `S63` (the target) of the observable twin's `statements.rpgle`. The twins are committed as `SC-ILE/EXPERIMENTS/lfmt-*`. 1. **`*DMY0` is id 24, 6 bytes, separator `FF`.** `lfmt-d01` (`%date(c6: *dmy0)`) against `lfmt-d02` (`%date(c6: *ymd0)`, the known row): `X'0001001800000006FF..'` against `X'0001001900000006FF..'`, the id is the only difference. 2. **Digits read as `*DMY` carry the descriptor of the `0` form.** `%date(n6: *dmy)` with `packed(6)` (`lfmt-d07`), `int(10)` (`-d09`) and `zoned(6)` (`-d10`) write `X'0001001800000006FF..'`, the same bytes as `lfmt-d01`. The compiler copies the number into a temporary first (`S307 = S259`), and `rpg_eval.dateConvertCall` reads that saved temporary: the format is the keyword without its last `0` (`s07`). `lfmt-d08` (`%date(n8: *iso)`, the known `*ISO0` row) is the pair. 3. **`*EUR0` is id 5, 8 bytes, separator `FF`.** `lfmt-d05` against `lfmt-d06` (`*iso0`, id 3): `X'0001000500000008FF..'` against `X'0001000300000008FF..'`. `%date(n8: *eur)` (`lfmt-d11`) writes the same bytes as `lfmt-d05`. 4. **`*HMS0` is kind 2, id 27, 6 bytes, separator `FF`.** `lfmt-t01` (`%time(c6: *hms0)`) against `lfmt-t02` (`%time(c8: *hms:)`, the known `*HMS` row, separator `7A`): `X'0002001B00000006FF..'` against `X'0002001B000000087A..'`. `%time(n6: *hms)` (`lfmt-t03`) writes the bytes of `lfmt-t01`. 5. **The default formats of the module do not change the source descriptor.** `lfmt-e01`, `-e02`, `-e03` (the program's header `ctl-opt datfmt(*eur) timfmt(*hms:)`) have the descriptors of `lfmt-d01`, `-d05`, `-t01`. The target field is then `date(*eur)` (`lfmt-e01`, `-e02`). 6. **`%CHAR(d: fmt)` writes the same descriptors as its target** (`S63` of `lfmt-g01`, `-g02`, `-g03`): `*DMY0`, `*DMY&` and `*EUR0`. The source of those three is the `*ISO` date with the separator `-` (`X'000100030000000A60..'`). 7. **`*DMY&` is id 24, 8 bytes, separator `40`** (`lfmt-d03` against `lfmt-d04`, `*dmy`, separator `61`). It is measured and **not a row** (below). 8. **`%time(n6: *iso)` is kind 2, id 4, 6 bytes, separator `FF`** (`lfmt-t04`). It is another descriptor, not a row: no dev5 statement needs it, and whether its id follows the module's `timfmt` was not measured. 9. **`%CHAR(t: *HMS0)` writes the `*HMS0` descriptor as its target** (`lfmt-g04`, recaptured with `t'08.00.00'`: the first attempt wrote `t'08:00:00'`, which is no `*ISO` time literal, `RNF0306`): `S63` is `X'0002001B00000006FF..'`, the source the `*ISO` time with the separator `.` (`X'00020004000000084B..'`). 10. **A source that the statement assembled in a temporary is not the digits of a field.** `%date(a + b: *iso0)` (`lfmt-x06`) and `%date(a + b: *ymd0)` (`-x07`) are two stores into one 8- or 6-byte temporary, and trunk (v0.1.522) emits `A_00255 = %DATE(A_00253);` and `A_00255 = %DATE(A_00253: *YMD);`: the first piece alone, and the keyword of the digits form. That is a wrong emit that exists at trunk for the rows `*ISO0`, `*YMD0` (and `*USA0`); with the new rows it would reach `*DMY0` and `*EUR0` too (`lfmt-x01`, `-x04` emit `%DATE(A_00253: *DMY)`, `%DATE(A_00253: *EUR)`). `rpg_eval.dateConvertCall` reads the saved temporary at byte 0 and takes it for the digits of a number (`s07`, the keyword minus its `0`); it does not check the width of the saved value against the descriptor. ## What recovers - `lfmt-d01`, `-d05`, `-d07`, `-d09`, `-d10`, `-d11`, `-e01`, `-e02`, `-t03`, `-g01`, `-g03` emit with no failure line (16 of the 21 probes of the first battery failed at trunk; 11 recover, and 5 keep a failure line: `lfmt-d03`, `-g02`, `-e03`, `-t01`, `-t04`, below). Examples: `A_00254 = %DATE(A_00253: *DMY0);`, `A_00254 = %DATE(A_00253: *EUR0);`, `A_00253 = %DATE(A_00254: *DMY);`, `A_00254 = %TIME(A_00253: *HMS);`, `A_00253 = %CHAR(A_00254: *DMY0);`. - dev5/p2 (`PF751FB55S`, measured with the host Debug build of this change against the host Debug build of trunk `fdb37831`): `statements 75, emitted 31, failures 44` becomes `emitted 37, failures 38`. Statements 52 (`%Date(Date_Char6:*dmy0)`), 68 and 78 (`%Date(Date_Char8:*eur0)`), 90 (`%Date(Date_Num6:*dmy)`), 164 and 173 (`%Time(Time_Num6:*hms)`) recover. Statements 60 and 144 are still failure lines (below). The failure lines of the `TEST(DE)` / `IF NOT %ERROR` / `ENDIF` blocks around them (groups of the statements 50, 51, 53 and their kin) are other causes and are unchanged. ## What is refused, and why `rpg_date_convert.recover` refuses a source of characters with no separator (`FF`) in an automatic storage that the statement itself addressed, read or stored into before the call, unless the number was saved with its own type word (`113 q 1`). `lfmt-x01`, `-x04`, `-x06` and `-x07` now keep a failure line instead of a wrong emit; the last two are the rows `*ISO0` and `*YMD0` of trunk, whose wrong emit this removes. A substring as the source (`lfmt-x02`, `-x03`, `-x05`) failed at trunk and still does. Two statements of the family keep a failure line. Each needs an edit in `rpg_source_stmt.zig` or `rpg_source.zig`, which another lane owns, so they are reported, not changed: - **Characters read as `*HMS0`** (`lfmt-t01`, `-e03`; p2 statement 144 `%Time(Time_Char6:*hms0)`) and **`%CHAR(t: *HMS0)`** (`lfmt-g04`). The row is here and the call is proved (`S254.0 = %TIME(S253: *HMS0)`), but `rpg_source_stmt.date_formats` (lines 434-438, read by `rpg_source.keyword`) has no `*HMS0`. Adding that one word recovers `lfmt-t01` and `-e03` (tried on this tree and reverted): `A_00254 = %TIME(A_00253: *HMS0);`. The same word would let `%CHAR(t: *HMS0)` through; `lfmt-g04` proves its descriptor but its emit has no round trip. - **`*DMY&`** (`lfmt-d03`, `-g02`; p2 statement 60 `%Date(Date_Char8:*dmy&)`). The descriptor is measured but no row is written: the emit could not read it back. `runtimeSummary` refuses a keyword that is not alphanumeric (`rpg_source_stmt.zig:225`, site `s11`), `date_formats` has no `*DMY&`, and with those two edits tried the failure moves to `rpg_source.translate s06` on `S254.0 = %DATE(S253: *DMY&)`: the expression reader does not take `&` as part of a word. A third site, not located. When that lane lands the three edits, the row to add is `.{ .id = 24, .length = 8, .separator = 0x40, .keyword = "*DMY&" }`. - **Digits read as `*ISO` time** (`lfmt-t04`, fact 8) keep their failure line: no row. - `lfmt-d07`, `-d10`, `-d11` and `-t03` carry `SOURCERER-TODO decimal_positions: not proved, 0 assumed` on the number field (a placeholder, as `lfmt-d08` does at trunk): a `packed` or `zoned` source has no proved decimal positions. Not changed. - Not probed, so refused: a numeric expression or function result as the source (`%date(n + 1: *dmy)`, `%date(%abs(n): *dmy)`), which also reaches `dateConvertCall` as a saved temporary. `savedNumber` accepts only the three captured chains of a whole packed, zoned or `int(10)` field before the `33 S` store. ## Tests `src/rpg_lfmt_test.zig`: the three rows and their numeric and `%CHAR` uses, the neighbours that must not change (`lfmt-d02`, `-d04`, `-d06`, `-d08`, `-t02`), the refusal of every twin that keeps a failure line (`lfmt-t04`, `-t01`, `-e03`, `-d03`, `-g02`, `-g04`, the substring sources `-x02`, `-x03`, `-x05` and the concatenated sources `-x01`, `-x04`, `-x06`, `-x07`), and the table (each row once; no row of the same id with a length or a separator that no probe shows). The tests that pin a refusal waiting for the other lane (`-t01`, `-e03`, `-d03`, `-g02`, `-g04`) become `recovers` lines when that lane lands its edit. Run red before each change: with the three rows absent the four `recovers` tests and the table test failed (first run, with four rows); with the rows and no guard the concatenation test failed (`lfmt-x01` wrote `%DATE(A_00253: *DMY)`); all pass with both. ## For the matrix Round trip on pub400 of the emitted source of the stripped twin (`roundtrip.sh`, run `rt1`, the build of the rows before the guard, which writes the same text for these twins): `lfmt-d01`, `-d05`, `-d07`, `-d09`, `-d10`, `-d11`, `-e01`, `-e02`, `-t03`, `-g01` and `-g03` all `match` (only `compilation` differs). `lfmt-d02`, `-d04`, `-d06`, `-d08` and `-t02` (trunk's own rows) were not round-tripped by this change. The twins that keep a failure line (`lfmt-d03`, `-e03`, `-g02`, `-g04`, `-t01`, `-t04` and the seven `-x` twins) cannot match and need a class row (`known_gap`, the reason in this fragment). ## ltst `test(de) *dmy0 c`, `test(te) *hms n` and the `if not %error` after them failed twice. The TEST compiles to a call of `_QRNX_DT_CHK` that no reader knew, so the statement kept only its plumbing (`S253 = '0'`, the descriptor stores). The `(E)` extender writes a one-byte flag that `IF %ERROR` reads, and that flag (`0x70008000`, a field of the compiler) had a %ERROR role for file operations only, so the IF failed with "no declaration of symbol", and each ENDIF of such a block with "its block is not whole". This change reads the whole TEST block as the statement (`rpg_test_op.zig`), names the flag `%ERROR` (`rpg_file_ops.zig`, `flagNames`) and lets `%ERROR` stand without a file (`rpg_source_files.zig`, `bif`: only when a TEST is proved, and never beside a file declaration that failed). `dev5/p2` goes from 44 failure lines (31 statements emitted of 75) to 14 (61 emitted): the 10 TESTs, the 10 IFs and the 10 ENDIFs of the 30 lines recover. The 14 are other families (below). The battery is `requests/ltst/test-error` (28 cases, captures `ltst-test-error`; `-c02` is dropped by the compiler, the other 27 are captured, 25 are committed as SC-ILE/EXPERIMENTS `ltst-c01` to `ltst-f15`; `-c07` and `-c12` stay in the data) and `test-error2` (`ltst-f16`, `-f17`, committed; `-d01` and `-d02` are dropped by the compiler, RNF7523). The test file is `src/rpg_test_op_test.zig`. ## The facts, and the probe pairs that decide them 1. **A TEST(DE) or TEST(TE) is one block with one call.** `ltst-c01` (`test(de) *dmy0 c`, c a `char(6)`) has: `27 0; 35 S54`, the address of the field into the descriptor (`34 F 0; 37 DS 16`), the 16 bytes of the format at DS+0 (`27 K; 37 DS 0`), 8 zero bytes as the options (`27 Z; 35 O`), the call `99 _QRNX_DT_CHK 2 0 0` with the addresses of DS and O, and a compare of the first 4 bytes of O with 0. The same block is statement 50 of `dev5/p2`. A return of 0 jumps to the label that ends the statement; anything else runs the error path, which writes the program status: the status moves from PSDS+10 to PSDS+15, the statement number goes to PSDS+20 as eight zoned digits (it equals the number of the statement in the `110` operation: 3 in `-c01`, 50 in p2), and the return code goes to PSDS+10 as five zoned digits. A TEST(D) and a TEST(T) differ in the kind byte of the format. 2. **The flag exists only when the program reads `%ERROR`.** `-c01` against `-c04` (c01 plus `if not %error; n = 1; endif`) differ in two stores (diffed on the raw operations): `27 '0'; 35 F` at the start of the statement and `27 '1'; 35 F` at the start of the error path. A TEST whose `%ERROR` no statement reads has neither (`-c01`, `-c03`, `-f01` to `-f17`), and is the same text. 3. **A free-form `test(d)` with neither the extender nor an indicator does not compile.** `-c02` (`test(d) *dmy0 c`) is dropped by the capture (compile message RNF5056; the text of the message was not read). So each twin has the extender, and the emit writes `(de)` or `(te)`. The fixed-form form with an `ER` indicator has no twin and is not read. 4. **`IF NOT %ERROR` and `IF %ERROR` differ in the comparison only.** `-c04` against `-c05`: the condition reads `NOT (F = '1')` against `(F = '1')`. These statements were `recovered` at the statements layer before this change; the failure was the declaration of F, a flag of the compiler, which a source cannot hold. Once F is `%ERROR` the text has no field of the compiler. 5. **One flag serves every `(E)` operation of the module.** `-c06` (two TESTs, two IFs) has one flag. `-c08` (`test(de)`, `callp(e) w()`, `if %error`): the CALLP(E) writes `'0'` into the symbol that the TEST writes. The flag is therefore `%ERROR` without a file, as the file operations name it; `flagNames` names it when every other write is a store of `'0'` or `'1'` (`exclusive`). The CALLP(E) itself has no rule (`-c07`: `S253 = '0'; S54 = 0` then the call, and the IF fails on the flag): a separate family, and it stays a failure line (`-c08` keeps exactly that one). 6. **The format is the descriptor of factor 1.** `-c13` has `ctl-opt datfmt(*eur) timfmt(*hms:)` and `test(de) *eur0 c`: the descriptor equals `-f02` (`*eur0` without the header). The header does not enter. `-c11` (a TEST in a procedure) is the same block with the same flag and program status; its field `c` is still a global `dcl-s`, so only the TEST sits in the procedure. Every twin tests a static global field (class 3, no owner) and the reader requires exactly that: an automatic field (class 4), a parameter (class 5) and a static field that a procedure owns refuse (`staticField`; the mutation test is in `src/rpg_test_op_test.zig`). Every refusal test asserts the emit as well as the proof: the statement stays a `SOURCERER-FAIL` line, with no `test(` line and no `%ERROR`. 7. **A number has the descriptor of the `0` form of its format.** `-f03` (`test(de) *dmy n`, n `packed(6:0)`) and `-c01` (`*dmy0`, `char(6)`) have the same descriptor constant (date, id 24, length 6, separator `FF`). A packed number is copied to a zoned temporary first (`29 N 0 T; 85 D 1; 35 Z; 34 Z 0`), a zoned number is read in place (`-f15`, `34 N 0`). The packed numbers that a twin shows are `*dmy` of a `packed(6:0)` (`-f03`), `*iso` of a `packed(8:0)` (`-f04`) and `*hms` of a `packed(6:0)` (`-f06`, `-c10`, p2 statements 162 and 171); the zoned numbers are a `*dmy` of a `zoned(6:0)` (`-f15`) and a `*hms` of a `zoned(6:0)` (`-f17`). `rows` has one cell for each of these, and the other cells stay empty. The reader takes a number only when its digits are the length of the format. 8. **`*hms:` and `*hms` are one descriptor.** `-f05` (`*hms:`) and `-f14` (`*hms`), both on a `char(8)`: the same format (time, id 27, length 8, separator `7A`, the colon). The emit writes `*hms`. The formats that a twin shows are in `rows` of `rpg_test_op.zig`, each with its descriptor: date `*DMY0` (24, 6, FF), `*DMY&` (24, 8, 40), `*EUR0` (5, 8, FF), `*ISO` (3, 10, 60), `*USA` (1, 10, 61), `*MDY` (23, 8, 61), `*YMD` (25, 8, 61), `*EUR` (5, 10, 4B), `*JUL` (26, 6, 61); a number `*DMY` (24, 6, FF), `*ISO` (3, 8, FF) and `*HMS` (27, 6, FF); time `*HMS0` (27, 6, FF), `*HMS` (27, 8, 7A), `*ISO` (4, 8, 4B). The descriptors are the measured ones of `rpg_date_convert.zig` where that file has the same format; this change does not read that table (the other lanes extend it) and does not edit it. ## What recovers - Battery cases (before is v0.1.522, after is this change): `-c01`, `-c03`, `-c04`, `-c05`, `-c06`, `-c09`, `-c10`, `-c11`, `-c13`, `-f01` to `-f17`: before, a failure line for the TEST (and for the IF and the ENDIF where there are some); after, none. `-c08` keeps one failure line, the CALLP(E). - `dev5/p2`: statements 50, 58, 66, 76, 88, 96, 142, 150, 162 and 171 (the TESTs), 51, 59, 67, 77, 89, 97, 143, 151, 163 and 172 (the IFs), 53, 61, 69, 79, 91, 99, 145, 153, 165 and 174 (the ENDIFs); emitted 31 to 61 of 75, failure lines 44 to 14. Statements 98 and 152 now sit in their block (`if NOT %ERROR; A = %DATE(...); endif;`). ## Not done, and why - A TEST of a date or time field (`test(de) d`, no factor 1): its descriptor is the native one, with the separator byte 0 (`rpg_date_convert.zig`), and no row of this change has that byte, so the statement refuses. Its twin would be `-d01` (`test(de) d`, a `date(*iso)`) and `-d02` (`test(te) t`, a `time(*iso)`): the compiler dropped both (RNF7523; the message text was not read), so the claim rests on the native descriptors of `rpg_date_convert.zig`, not on a TEST twin. - A TEST with another format (a character field with `*DMY` and its slash, `*USA0`, `*JIS`, `*CYMD`, a timestamp TEST(Z), an `ER` indicator form, an array element, a subfield, a varying field, a field local to a procedure, a parameter): no twin, no row, the statement stays a failure line. Each format is one row and one twin. - The decimal positions of a number that a TEST names are not read from the object: it holds none, and the language requires 0, so the declaration has 0 and the `SOURCERER-TODO decimal_positions` placeholder stays (`-c10`, `-f03`, `-f04`, `-f06`, `-f15`, `-f17`). - The 14 failure lines left in p2 are not this family. Statements 52, 60, 68, 78, 90, 144, 164 and 173 (the `%DATE(c: *dmy0)` and `%TIME(c: *hms0)` after a TEST) are `rpg_date_convert.zig` and need its format rows for the descriptors above that it lacks (`*DMY0`, `*DMY&`, `*EUR0`, `*HMS0`) and for a number as the source (`S307 = S259` first). Statements 170, 208, 214, 215, 220 and 221 are the time and multiplication families. - `CALLP(E)` and every other `(E)` operation that is not a file operation or a TEST: `-c07`, and the flag store of `-c08`. ## For the matrix `ltst-c01` to `-f17` except `-c08` have no failure line and are for the round trip; `-c08` keeps the CALLP(E) failure line and needs a class row (`known_gap`, the reason in this fragment). ## Gate ``` == a. development emits (dev-hash) p1 DIFFERENT p2 DIFFERENT 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) p1 base=[24,10,14] head=[24,18,6] CHANGED fail-lines=6 p2 base=[75,31,44] head=[75,67,8] CHANGED fail-lines=8 lfmt-d01-dmy0-c6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-d05-eur0-c8 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-d07-dmy-n6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-d09-dmy-i6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-d10-dmy-z6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-d11-eur-n8 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-e01-dmy0-eurhdr base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-e02-eur0-eurhdr base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-e03-hms0-hmshdr base=[2,1,1] head=[2,1,1] CHANGED fail-lines=1 lfmt-g01-char-dmy0 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-g03-char-eur0 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-t01-hms0-c6 base=[2,1,1] head=[2,1,1] CHANGED fail-lines=1 lfmt-t03-hms-n6 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lfmt-g04-char-hms0 base=[2,1,1] head=[2,1,1] CHANGED fail-lines=1 lfmt-x06-cat-iso0 base=[2,2,0] head=[2,1,1] CHANGED fail-lines=1 lfmt-x07-cat-ymd0 base=[2,2,0] head=[2,1,1] CHANGED fail-lines=1 lne-p10-ne base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0 lne-p13-ne base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0 lne-p8-ne-else base=[9,6,3] head=[9,9,0] CHANGED fail-lines=0 lne-p8-ne-p9 base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0 lne-p8-ne base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0 lne2-p8-n-and-ne base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0 lne2-p8-ne-and-n base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0 lne2-p8-ne-or-n base=[7,5,2] head=[7,7,0] CHANGED fail-lines=0 ltst-c01-de-dmy0 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 ltst-c03-te-hms0 base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 ltst-c04-ifnot base=[5,2,3] head=[5,5,0] CHANGED fail-lines=0 ... 90 lines omitted; the full table is in gate.log ... lne-padded-ne/lne-p10-ne base=different head=match lne-padded-ne/lne-p13-ne base=different head=match lne-padded-ne/lne-p5-eq base=match head=match lne-padded-ne/lne-p5-ne base=match head=match lne-padded-ne/lne-p8-eq base=match head=match lne-padded-ne/lne-p8-ne-else base=different head=match lne-padded-ne/lne-p8-ne-p9 base=different head=match lne-padded-ne/lne-p8-ne base=different head=match lne-padded-ne2/lne2-p8-n-and-ne base=different head=match lne-padded-ne2/lne2-p8-ne-and-n base=different head=match lne-padded-ne2/lne2-p8-ne-or-n base=different head=match ltst-test-error/ltst-c01-de-dmy0 base=different head=match ltst-test-error/ltst-c03-te-hms0 base=different head=match ltst-test-error/ltst-c04-ifnot base=different head=match ltst-test-error/ltst-c05-if base=different head=match ltst-test-error/ltst-c06-two base=different head=match ltst-test-error/ltst-c09-ifnot-time base=different head=match ltst-test-error/ltst-c10-num-time base=different head=match ltst-test-error/ltst-c11-proc base=different head=match ltst-test-error/ltst-c12-assign base=match head=match ltst-test-error/ltst-c13-header base=different head=match ltst-test-error/ltst-f01-dmy-amp base=different head=match ltst-test-error/ltst-f02-eur0 base=different head=match ltst-test-error/ltst-f03-dmy-p6 base=different head=match ltst-test-error/ltst-f04-iso-p8 base=different head=match ltst-test-error/ltst-f05-hms-colon base=different head=match ltst-test-error/ltst-f06-hms-p6 base=different head=match ltst-test-error/ltst-f07-iso base=different head=match ltst-test-error/ltst-f08-usa base=different head=match ltst-test-error/ltst-f09-mdy base=different head=match ltst-test-error/ltst-f10-ymd base=different head=match ltst-test-error/ltst-f11-eur base=different head=match ltst-test-error/ltst-f12-jul base=different head=match ltst-test-error/ltst-f13-time-iso base=different head=match ltst-test-error/ltst-f14-time-hms base=different head=match ltst-test-error/ltst-f15-dmy-z6 base=different head=match ltst-test-error2/ltst-f16-iso0 base=different head=match ltst-test-error2/ltst-f17-hms-z6 base=different head=match gate: PASS ```
sean added 13 commits 2026-11-16 13:16:31 +00:00
rpg_value_units.padded proved only BASED(P) = 'L'. The <> form of the same
field and literal compiles to the same unit with the compare 8, the branch
16 and the first result constant 1: the unit now takes both polarities, each
with its own operation template, and a unit that mixes them refuses.
dev5/p1: emitted 10 to 18, failures 14 to 6 (the IF of statements 91, 98,
105 and 111 and the ENDIF of their blocks). The three-way compares, two
padded compares of one condition, a literal on the left and a field against
a parameter keep their failure line.
The format table of the date run time had no row for three descriptors that the
compiler writes for %DATE(x: fmt) and %TIME(x: fmt), so the source descriptor of
_QRNX_DT_CVT named no measured format and the statement failed at the call. Each row
is the descriptor literal of one capture (lfmt-d01, -d05, -t01); digits read as *DMY,
*EUR and *HMS carry the same descriptor as the 0 form, and %CHAR writes it as its
target. *DMY& is measured but not a row, and characters read as *HMS0 stay a failure
line: both need an edit in rpg_source_stmt.zig.
A source of characters with no separator that the statement stored into a temporary
before the call (%date(a + b: *iso0)) was written as its first piece alone, with the
keyword of the digits form: %DATE(A_00253). Trunk does this for *ISO0 and *YMD0; the
new rows would do it for *DMY0 and *EUR0. recover now refuses an automatic source of a
no-separator format that the statement addressed or stored into before the call,
unless the number was saved with its own type word. Adds the captures of the
concatenated and substring sources and of %CHAR(t: *HMS0). The words that the emit
cannot read back (*DMY& and *HMS0 as a keyword) need edits in rpg_source_stmt.zig and
rpg_source.zig, named in the change fragment.
The saved_digits layout (33 S; 113 q 1; 33 T; 113 q 2; 5 after a 37 S) was
proved for any source that the compiler saved with a type word. With the rows
*DMY0, *EUR0 and *HMS0 that put a numeric expression or a function result on
the emit path: a mutant of lfmt-d07 with the %ABS operation after the load
wrote A_00253 = %DATE(%ABS(A_00254): *DMY). No capture shows that shape.

recover now proves a saved source only when the operations before the 33 S are
one of the three chains of a whole numeric field that the captures show
(packed, zoned, integer), bound to the saved storage, the digits of the format
and the types, and the field is not stored into or addressed earlier in the
statement. Every other chain refuses. All 1090 stripped twins of the committed
testdata hold nine such chains, and all nine fit one of the three.
TEST with a format factor compiles to one block that calls _QRNX_DT_CHK. The reader proves the
whole block (the descriptor of the format of factor 1, the field read in place or copied from a
packed number, the program status of the error path) and writes `test(de) *dmy0 field;`. The
(E) flag exists only when the module reads %ERROR; it is named %ERROR, without a file, when
every other write to it is a store of '0' or '1', so IF NOT %ERROR and its ENDIF recover.
Formats that no twin shows stay failure lines.
The tested field of a TEST(DE) or TEST(TE) must be class 3 with no owner, as every twin shows it; an
automatic field, a parameter and a field that a procedure owns refuse. The bare %ERROR that a TEST sets
is refused when a file declaration failed. Tests mutate the storage of the field, assert the emitted text
of a refused TEST (a failure line, no test( line and no %ERROR), and read bif for both values of test_error.
Each refusal test (every operation changed, a format no twin shows, a descriptor of another kind of field,
a field not as long as its format, digits that are not the length, the statement number, and the storage
of the tested field) now checks the emit as well as the proof: the statement stays a SOURCERER-FAIL
line, with no test( line and no %ERROR. The mutation that lets any storage class through fails the
storage test.
Regenerate the operations legend
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
456dcee5f2
sean force-pushed stack-lne-lfmt-ltst-20261115 from 456dcee5f2
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
to 89ef365f3e
All checks were successful
binjovi/ci Binjovi completed the frozen plan
2026-11-16 13:16:35 +00:00
Compare
binjovi-bot manually merged commit 89ef365f3e into trunk 2026-11-16 13:33:56 +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!807
No description provided.