A call of an imported C-runtime procedure from a procedure or main() recovers with its prototype #805

Manually merged
binjovi-bot merged 3 commits from lcimp into trunk 2026-11-15 06:45:06 +00:00
Owner

A call of an imported C-runtime procedure from a procedure or main() recovers with its prototype

fclose(f), rc = fclose(f), p = fopen(%addr(a): %addr(b)), p = fgets(%addr(buf): 150: f),
p = geterr() of __errno and cee_discardHeap(heap: *omit) failed at importFrame: the frame of
a call that a procedure makes is not the frame of the cycle. This change reads the frame of a
procedure, reads each argument from the call site and the return from the symbol of the import, and
writes the prototype from them: dcl-pr P int(10) extproc('_C_IFS_fclose'); *n pointer value; end-pr;.
What the object does not tell stays a failure line: p = fgets(%addr(buf): %size(buf): f) is one of them
(fact 8). 21 of the 22 clean twins of the battery round-trip to the same object on the host (match,
only compilation differs); the 22nd, lcimp-r03, keeps its failure line.

The battery is requests/lcimp/cimport (16 cases, captures lcimp-cimport), cimport2 (13 cases:
return and argument types), and the clean programs for the round trip, cimport3b, 3c, 3d
(21 cases, no unused field, compiled with DFTACTGRP(*NO) BNDDIR(QC2LE)), cimport3e (r22, a dropped
int(3)), cimport3i (d14) and cimport3f (d15). SC-ILE/EXPERIMENTS holds lcimp-r01 to
lcimp-r22 and the seven refusals lcimp-d05, -d06, -d08, -d10, -d11, -d14, -d15.

The facts, and the probe pairs that decide them

  1. The call information copy follows the caller. cimport/c01-cycle against c02-proc differ in
    the caller only (the loop captures; the committed twins are lcimp-r06-cycle and -r01-drop).
    The cycle has 27 I; 37 S 92 C10 and the blank of S+102. A procedure has 27 I; 1; 37 C 26 C10; 37 S 92 C10, the blank of S+102 and the blank of C+16 (C the 48-byte call information of the
    procedure, callInformation). c03-main against c02-proc (main() only) has the same
    operations: a main() procedure is a procedure (lcimp-r10-main). The header (99 P N 0 1) is
    independent of the caller: lcimp-r09-clib (extproc('fclose')) has the header and the copy,
    _C_IFS_*, __errno and CEE* have neither (the header follows the name, as for usleep,
    printf and strcat).
  2. The last argument is no part of the frame. importFrame required a null pointer before unit 1
    in the no-header form (*OMIT, h-ceeran). r06 has a pointer variable there, and lcimp-r15-noargs
    has no argument (99 P 0 0 0). The frame is units 1 and 2, the optional header, the name and the
    blanks; the arguments are read apart.
  3. A 113 q 2 after an argument is a reference, no tag is a value. lcimp-r08-byref
    (s pointer) against -r01-drop (s pointer value) differ in the prototype only: 34 f 0; 113 9 2 against 29 f 0 3. An untagged 34 X 0 (%addr(x), -r05, -r03) or 29 P 0 T (a
    pointer variable) is a pointer value. Every by-reference argument that recovers today is tagged
    (h-extproc, h-ceeran, dict-calls3, -4, -5).
  4. The conversions after a number tell the size of the parameter. 27 K; 78 8; 75 4; 75 4 and
    29 n 0 T; 75 8; 75 4; 75 4 are an int(10) value (-r04 the literal 150, -r17 a variable;
    -r03 %size(buf) has the same operations and is refused, fact 8). An int(5) has 75 2; 75 2
    (-d05), an unsigned 76 (-d06), an int(20) has none (-d08): refused.
  5. The symbol of the import records the type of the return. The kind is the top byte of its word
    28 (1 signed binary, 2 unsigned binary, 9 pointer, 0x11 none) and the size in bytes is its word
    20. int(3), int(5) and int(10) compile to the same operations (99; 75 8), and a dropped
    int(20) and a dropped pointer to the same too (99; 3); only the symbol tells them apart
    (cimport2 d01, d03 and cimport c02, c06, c09: 2, 1, 4, 8 and 16 bytes). lcimp-r11-ret-int5
    (dropped) and -r12-ret-int5-set round-trip with int(5), and lcimp-r22-drop-int3 (a 1-byte symbol)
    with int(3); with int(10) for the symbol of an
    int(5) the first attempt differed in the symbols, which is how the word was found. The
    operations then have to be the measured ones of the type: a binary of 1, 2 or 4 bytes is widened
    by 75 8 right after the call (76 8 for uns(10)), the others are not; a dropped result is
    popped by 3; a result that a store consumes is the store of a pointer, or 75 S; 75 S; 37 X 0 T
    of an int(5) or an int(10) of the size S. Other kinds and widths (uns(5), a float, a packed
    result, a stored int(20)) have no probe and no verdict.
  6. A call that returns nothing leaves nothing on the stack. Only the labels and the jumps that
    end a block follow it: the jump to the end of the procedure (-r07), an IF without ELSE
    (-r13, -r14 in the cycle), the jump over an ELSE (-r18). A pop, a compare or any other
    operation after a call that the symbol says returns nothing refuses; so does a call with a result
    and no pop or consumer.
  7. A null pointer is *OMIT only for a CEE service. -d11-null-last (fgets(b: 150: *null))
    compiles to the operations of an *OMIT; the emit writes *OMIT and the feedback code
    char(12) options(*omit) for a name that starts with CEE (h-ceeran, -r07) and refuses for any
    other name, and only for the last argument.
  8. %SIZE(buf) is not the literal 150. lcimp-r03 (%size(buf)) and -r04 (150) have the same
    operations; the round trip of the emit 150 for r03 differs in the creation instructions, the symbols,
    the literals, the constant area and the initialization. The compiler folds %SIZE to the number and
    leaves a packed constant of that value that no operation loads (rpg_elem_count.zig); the literal has
    none. An integer constant is read as a literal only when the module holds no such constant of its value
    (rpg_elem_count.leftByBuiltin), else the call refuses. A literal that shares its value with a %SIZE
    elsewhere in the module refuses too: which one is which is not proved.
  9. A call of one import has one set of forms. lcimp-d15-two-forms calls CEEDSHP(n: fc) and
    CEEDSHP(n: *omit): the second statement reads as another form of the second parameter than the
    prototype of the first, and keeps its failure line. lcimp-d14-copy-const (CEEDSHP(5: *omit) to a
    CONST int(10)) passes the untagged address of a compiler temporary (37 T; 33 T; 113 q 1): the site
    reads a copy and the emit keeps the failure line.

What changed

  • rpg_import_site.zig (new, PURE): the call site. read walks the operations of the statement
    before the frame with the stack walk of rpg_value_pointer (now step, one operation, and
    Item.from, where a value began) and gives the form of each argument (reference,
    pointer_value, int10_value, omitted, copy for the untagged address of a compiler temporary,
    which keeps the old text of the failure) and the return (from the symbol, and whether a store
    consumes it).
  • int10 takes an integer constant only when rpg_elem_count.leftByBuiltin says that no folded builtin
    left a constant of its value (fact 8), and no other kind of constant.
  • rpg_frames.importFrame reads the four frames (header, call information copy; no argument).
    rewrite refuses a call with no site, and gives the call operation the forms and the return.
  • rpg_eval.call renders each argument by its form: a reference as the data, %ADDR(x) or a pointer
    variable for a value, a number for an int(10).
  • Emitter.importCall reads the same site from the original operations of the statement and writes
    Prototype.Parameter.pointer_value and .int10_value and Prototype.returns; the prototype
    writer puts the return type after the name. A second call of one import has to agree with the first
    in every form and in the return, or it fails. Emitter.expression takes the call of an import
    inside an expression (p = fgets(...); the name may start with _).

Measured

The 32 public scout programs (captures/l10-scout2, l10-scout2b: 33 directories, one program is in
both trees and counted once), base v0.1.521 against this build, capture-emit-diff.sh: statements
512, emitted 295 to 306, failures 224 to 213 (runs/lcimp/scout-fix, the build with the %SIZE refusal of
fact 8). Six programs change; every changed statement is an import call, and each reads as its source line:

program emitted failures the statements that recover
barrettotte ifsread 9 to 11 21 to 19 fptr = fopen(%addr(fpath): %addr(fmode)), fclose(%addr(fpath))
adventofcode2025-1 31 to 33 14 to 12 fclose(stream), p_errno = sys_errno()
adventofcode2025-2 40 to 42 25 to 23 the same two
adventofcode2025-3, -4 15 to 17 13 to 11 the same two, in each
ossile-6 2 to 3 12 to 11 cee_discardHeap(heapId: *omit)

7 of the 15 statements of the triage recover (2 + 1 + 1 + 1 + 1 + 1); the other 8 are the
success = fgets(%ADDR(buffer): %SIZE(buffer): stream) lines of the four adventofcode programs, which keep
their failure line (fact 8: the emit 150 is another object). The four __errno statements of the next
token recover. The first version of this change emitted those eight as fgets(%ADDR(buffer): 150: stream)
(emitted 314, failures 205) and was refused in review for it. agree.sh over the 32 programs: same 148 to
151, suspect 12 to 12, wrong parameters 0 to 0. The 1347 public captures under captures/ (the lext import
twins, dev5, l10-pgm-a1 and -a2 among them) were measured with the first version: only those six programs
changed, and the refusal only takes emitted statements away; the usleep twins stay as they were (their
uns(10) value argument refuses).

The committed twins (emit-all over src/testdata, base against head): none gets worse; 3 existing
twins change: TSELR (fclose(f) recovers, the prototype reads as its source), dict-calls3 (the
strcmp prototype has its int(10) return, and I = cpyr(C: C2) recovers) and dict-calls4 (a failure
line says CALLP strcat(...) in place of unresolved). h-ceeran, which matches on the host, keeps
its text byte for byte, and so does a void CEE call in the cycle (lcimp-r14, base and head equal).

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

twin shape verdict
r01 fclose(f) dropped, from a procedure match
r02 rc = fclose(f) match
r03 p = fgets(%addr(buf): %size(buf): f) refused, a failure line. The emit 150 of the first version was different: creation instructions, symbols, literals, constant area, initialization, imports
r04 the same with the literal 150 match
r05, r08, r09, r10, r06 fopen, a reference, the C library name with a header, main(), the cycle match
r07, r13, r14, r18 CEEDSHP(n: *omit), alone, in an IF, in the cycle, before an ELSE match
r11, r12 an int(5) dropped and stored match
r15, r16, r17 __errno without argument, two calls of one import, an int(10) variable match
r19, r20, r21 a dropped int(20), pointer and uns(10) match
r22 a dropped int(3) match (run pub-lcimp-r22-drop-int3-011901)

r03 is the folded builtin: %SIZE(buf) leaves a packed constant that no operation loads
(rpg_elem_count.zig), and the literal 150 of r04 has none. The operations are equal, and the object
differs; the first version of this change wrote 150 for both and r03 did not round trip. A constant with
such a head is no literal, and the call refuses (fact 8). Eight of the fifteen statements of the triage are
this shape; a rule that writes %SIZE(buf) for it (the buffer is the field that %ADDR names in the first
argument) is the next change, not this one.

Not done, and why

  • A dropped result of a width without a probe, a result that a compare, a condition or another
    operation consumes (lcimp-d10), an int(5), an unsigned or an int(20) value argument
    (-d05, -d06, -d08), a null that is not the last argument or not of a CEE name (-d11), a
    pointer plus a byte (29 P 0 T; ...; 62, untagged), the address of a compiler temporary (-d14), a
    second call of one import whose forms or return differ from the first (-d15) and an integer constant
    that a %SIZE or %LEN may have left (-r03): the site has no verdict, the statement stays a failure
    line. A null that is not the last argument and a pointer plus a byte are pinned by mutation tests of
    lcimp-r07 and -r01; every other refusal has a twin.
  • The options(*string) family (fopen(filename: options) with characters): the arguments are
    temporaries of a copy that ends in a zero byte, another family.
  • bnddir('QC2LE') is not in the ctl-opt of the emit; the object does not say it. The round trip of
    a program that calls _C_IFS_* needs the binding directory in the compile command (the commands
    of the committed r twins carry it, probe.json).

For the matrix

lcimp-r01 to -r22 except -r03 match on the host. -r03 keeps a failure line (above), as do the
seven refusals (-d05, -d06, -d08, -d10, -d11, -d14, -d15) by design: they have a failure
line, and some have unused fields and bnddir in their ctl-opt. None of them can match, and they need a
class row (known_gap, the reason in this fragment).

Gate (host round trips, base = ~/bin/sourcerer, the code of v0.1.521)

== a. development emits (dev-hash)
p1 same
p2 same
p3 same
p4 same
p5 same
== b. L10-test direction
L10-test rose
== c. committed twins (emit-bytes-diff)
emit text differs:
diff -r -x emit.ndjson -x *.receipt.json /Users/someara/data/sourcerer-loop/runs/emitbytes.OmC0Yo/base-emit/151-PB9B6E52BS.rpgle /Users/someara/data/sourcerer-loop/runs/emitbytes.OmC0Yo/head-emit/151-PB9B6E52BS.rpgle
6c6
< dcl-pr A_00262 extproc('strcmp');
---
> dcl-pr A_00262 int(10) extproc('strcmp');
11a12
> dcl-s A_00267 int(10);
56d56
< 
79c79
< // SOURCERER-FAIL statement 79: CALLP strcmp(S256: S266); S267 = strcmp
---
> A_00267 = A_00262(A_00256: A_00266);
81c81
< // SOURCERER-FAIL statement 81: CALLP strcat(S256: S266); S268 = strcat
---
> // SOURCERER-FAIL statement 81: S268 = strcat(%ADDR(S256): %A... (token: word without a declaration)
87c87
< // sourcerer: recovered source of PB9B6E52BS.PGM; statements 16, emitted 2, failures 14
---
forms projection differs:
36c36
< {"twin":"savf/SC-CONSTRUCT/TSELR","object":"TSELR","status":"done","statements":19,"emitted":15,"failures":4,"lines":57,"form_counts":{"compiler_policy_marks_v1":4,"context_character_literal_v1":4,"context_pointer_store_v1":4,"context_procedure_pointer_store_v1":4,"context_zero_fill_v1":4,"emit_assign_field_v1":4,"emit_ctl_opt_v1":1,"emit_dcl_pi_v1":4,"emit_dcl_proc_v1":4,"emit_dcl_s_v1":4,"emit_end_pi_v1":4,"emit_end_proc_v1":4,"emit_free_v1":1,"emit_pi_parameter_v1":8,"emit_return_value_v1":3,"emit_summary_v1":2,"fail_statement_v1":4,"initialization_entry_v1":4,"initialization_resume_v1":4,"integer_store_v1":4,"layout_blank_v1":14,"local_pointer_store_v1":1,"placeholder_decimal_positions_v1":14,"procedure_end_guard_v1":3,"procedure_exit_transfer_v1":4,"procedure_packed_literal_v1":2,"procedure_return_v1":4},"text_sha256":"eb8c88ef896e0131b54f87afcaf7cb2ab1d2b1c4aad0bbb8ce034203e09c3b83"}
---
== d. captures (capture-emit-diff)
lcimp-c01-cycle base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lcimp-c02-proc base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c03-main base=[3,2,1] head=[3,3,0] CHANGED fail-lines=0
lcimp-c04-byref base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c05-result base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c06-int20 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c07-clib base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c08-ptr-assigned base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c09-ptr-dropped base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c11-fgets-lit base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c12-fgets-var base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c13-ceedshp base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c14-two-calls base=[6,4,2] head=[6,6,0] CHANGED fail-lines=0
lcimp-c15-local-ptr base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-c16-addr-arg base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-d01-ret-int5 base=[5,4,2] head=[5,5,1] CHANGED fail-lines=1
lcimp-d02-ret-uns10 base=[5,4,2] head=[5,5,1] CHANGED fail-lines=1
lcimp-d03-ret-int3 base=[5,4,2] head=[5,5,1] CHANGED fail-lines=1
lcimp-d04-ret-int5-assigned base=[5,4,2] head=[5,5,1] CHANGED fail-lines=1
lcimp-d11-null-last base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1
lcimp-d12-noargs base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-d13-noargs-int base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r01-drop base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r02-result base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r04-fgets-lit base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r05-fopen base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r06-cycle base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0
lcimp-r07-ceedshp base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r08-byref base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r09-clib base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r10-main base=[3,2,1] head=[3,3,0] CHANGED fail-lines=0
lcimp-r11-ret-int5 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r12-ret-int5-set base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r13-void-if base=[7,6,1] head=[7,7,0] CHANGED fail-lines=0
lcimp-r15-noargs base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r16-two-calls base=[6,4,2] head=[6,6,0] CHANGED fail-lines=0
lcimp-r17-fgets-var base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r18-void-else base=[9,8,1] head=[9,9,0] CHANGED fail-lines=0
lcimp-r19-drop-int20 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r20-drop-ptr base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r21-drop-uns10 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-r22-drop-int3 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0
lcimp-d15-two-forms base=[6,4,2] head=[6,5,1] CHANGED fail-lines=1
lcimp-e4-const-lit base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1
lcimp-e5-const-int5 base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1
lcimp-e6-const-char base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1
lcimp-d14-copy-const base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1
l10-barrettotte-vscode-ibmi-languages-1 base=[27,9,21] head=[27,11,19] CHANGED fail-lines=19
l10-briangarland-adventofcode2025-1 base=[45,31,14] head=[45,33,12] CHANGED fail-lines=12
l10-briangarland-adventofcode2025-2 base=[65,40,25] head=[65,42,23] CHANGED fail-lines=23
l10-briangarland-adventofcode2025-3 base=[28,15,13] head=[28,17,11] CHANGED fail-lines=11
l10-briangarland-adventofcode2025-4 base=[28,15,13] head=[28,17,11] CHANGED fail-lines=11
l10-ossile-ossile-6 base=[13,2,12] head=[13,3,11] CHANGED fail-lines=11
capture-emit-diff: 102 cases, 53 changed, 44 with no failure line in the head emit
== e. source agreement (agree)
suspect        base=89 head=89
conflict       base=0 head=0
params_wrong   base=15 head=15
decl_missing   base=183 head=183
decl_extra     base=27 head=27
type_unmarked  base=50 head=50
== f. host round trips (both binaries)
cases to round-trip: 44
lcimp-cimport/lcimp-c01-cycle                      base=different head=different
lcimp-cimport/lcimp-c02-proc                       base=different head=different
lcimp-cimport/lcimp-c03-main                       base=different head=different
lcimp-cimport/lcimp-c04-byref                      base=different head=different
lcimp-cimport/lcimp-c05-result                     base=different head=different
lcimp-cimport/lcimp-c06-int20                      base=different head=different
lcimp-cimport/lcimp-c07-clib                       base=different head=different
lcimp-cimport/lcimp-c08-ptr-assigned               base=different head=different
lcimp-cimport/lcimp-c09-ptr-dropped                base=different head=different
lcimp-cimport/lcimp-c11-fgets-lit                  base=different head=different
lcimp-cimport/lcimp-c12-fgets-var                  base=different head=different
lcimp-cimport/lcimp-c13-ceedshp                    base=different head=different
lcimp-cimport/lcimp-c14-two-calls                  base=different head=different
lcimp-cimport/lcimp-c15-local-ptr                  base=different head=different
lcimp-cimport/lcimp-c16-addr-arg                   base=different head=different
lcimp-cimport2/lcimp-d12-noargs                    base=different head=different
lcimp-cimport2/lcimp-d13-noargs-int                base=different head=different
lcimp-cimport3b/lcimp-r01-drop                     base=different head=match
lcimp-cimport3b/lcimp-r02-result                   base=different head=match
lcimp-cimport3b/lcimp-r04-fgets-lit                base=different head=match
lcimp-cimport3b/lcimp-r05-fopen                    base=different head=match
lcimp-cimport3b/lcimp-r06-cycle                    base=different head=match
lcimp-cimport3b/lcimp-r07-ceedshp                  base=different head=match
lcimp-cimport3b/lcimp-r08-byref                    base=different head=match
lcimp-cimport3b/lcimp-r09-clib                     base=different head=match
lcimp-cimport3b/lcimp-r10-main                     base=different head=match
lcimp-cimport3b/lcimp-r11-ret-int5                 base=different head=match
lcimp-cimport3b/lcimp-r12-ret-int5-set             base=different head=match
lcimp-cimport3c/lcimp-r13-void-if                  base=different head=match
lcimp-cimport3c/lcimp-r14-void-if-cycle            base=match head=match
lcimp-cimport3c/lcimp-r15-noargs                   base=different head=match
lcimp-cimport3c/lcimp-r16-two-calls                base=different head=match
lcimp-cimport3c/lcimp-r17-fgets-var                base=different head=match
lcimp-cimport3c/lcimp-r18-void-else                base=different head=match
lcimp-cimport3d/lcimp-r19-drop-int20               base=different head=match
lcimp-cimport3d/lcimp-r20-drop-ptr                 base=different head=match
lcimp-cimport3d/lcimp-r21-drop-uns10               base=different head=match
lcimp-cimport3e/lcimp-r22-drop-int3                base=different head=match
dev5/p3                                            base=match head=match
dev5/p4                                            base=match head=match
dev5/p5                                            base=match head=match
l10-scout2b/l10-danlong005-openrpg/l10-danlong005-openrpg-1 base=match head=match
l10-scout2b/l10-danlong005-openrpg/l10-danlong005-openrpg-4 base=match head=match
l10-scout2b/l10-danlong005-openrpg/l10-danlong005-openrpg-5 base=match head=match
gate: PASS
# A call of an imported C-runtime procedure from a procedure or `main()` recovers with its prototype `fclose(f)`, `rc = fclose(f)`, `p = fopen(%addr(a): %addr(b))`, `p = fgets(%addr(buf): 150: f)`, `p = geterr()` of `__errno` and `cee_discardHeap(heap: *omit)` failed at `importFrame`: the frame of a call that a procedure makes is not the frame of the cycle. This change reads the frame of a procedure, reads each argument from the call site and the return from the symbol of the import, and writes the prototype from them: `dcl-pr P int(10) extproc('_C_IFS_fclose'); *n pointer value; end-pr;`. What the object does not tell stays a failure line: `p = fgets(%addr(buf): %size(buf): f)` is one of them (fact 8). 21 of the 22 clean twins of the battery round-trip to the same object on the host (`match`, only `compilation` differs); the 22nd, `lcimp-r03`, keeps its failure line. The battery is `requests/lcimp/cimport` (16 cases, captures `lcimp-cimport`), `cimport2` (13 cases: return and argument types), and the clean programs for the round trip, `cimport3b`, `3c`, `3d` (21 cases, no unused field, compiled with `DFTACTGRP(*NO) BNDDIR(QC2LE)`), `cimport3e` (`r22`, a dropped `int(3)`), `cimport3i` (`d14`) and `cimport3f` (`d15`). SC-ILE/EXPERIMENTS holds `lcimp-r01` to `lcimp-r22` and the seven refusals `lcimp-d05`, `-d06`, `-d08`, `-d10`, `-d11`, `-d14`, `-d15`. ## The facts, and the probe pairs that decide them 1. **The call information copy follows the caller.** `cimport/c01-cycle` against `c02-proc` differ in the caller only (the loop captures; the committed twins are `lcimp-r06-cycle` and `-r01-drop`). The cycle has `27 I; 37 S 92 C10` and the blank of S+102. A procedure has `27 I; 1; 37 C 26 C10; 37 S 92 C10`, the blank of S+102 and the blank of C+16 (C the 48-byte call information of the procedure, `callInformation`). `c03-main` against `c02-proc` (main() only) has the same operations: a `main()` procedure is a procedure (`lcimp-r10-main`). The header (`99 P N 0 1`) is independent of the caller: `lcimp-r09-clib` (`extproc('fclose')`) has the header and the copy, `_C_IFS_*`, `__errno` and `CEE*` have neither (the header follows the name, as for `usleep`, `printf` and `strcat`). 2. **The last argument is no part of the frame.** `importFrame` required a null pointer before unit 1 in the no-header form (`*OMIT`, h-ceeran). `r06` has a pointer variable there, and `lcimp-r15-noargs` has no argument (`99 P 0 0 0`). The frame is units 1 and 2, the optional header, the name and the blanks; the arguments are read apart. 3. **A `113 q 2` after an argument is a reference, no tag is a value.** `lcimp-r08-byref` (`s pointer`) against `-r01-drop` (`s pointer value`) differ in the prototype only: `34 f 0; 113 9 2` against `29 f 0 3`. An untagged `34 X 0` (`%addr(x)`, `-r05`, `-r03`) or `29 P 0 T` (a pointer variable) is a `pointer value`. Every by-reference argument that recovers today is tagged (h-extproc, h-ceeran, dict-calls3, -4, -5). 4. **The conversions after a number tell the size of the parameter.** `27 K; 78 8; 75 4; 75 4` and `29 n 0 T; 75 8; 75 4; 75 4` are an `int(10) value` (`-r04` the literal 150, `-r17` a variable; `-r03` `%size(buf)` has the same operations and is refused, fact 8). An `int(5)` has `75 2; 75 2` (`-d05`), an unsigned `76` (`-d06`), an `int(20)` has none (`-d08`): refused. 5. **The symbol of the import records the type of the return.** The kind is the top byte of its word 28 (1 signed binary, 2 unsigned binary, 9 pointer, 0x11 none) and the size in bytes is its word 20. `int(3)`, `int(5)` and `int(10)` compile to the same operations (`99; 75 8`), and a dropped `int(20)` and a dropped pointer to the same too (`99; 3`); only the symbol tells them apart (`cimport2` d01, d03 and `cimport` c02, c06, c09: 2, 1, 4, 8 and 16 bytes). `lcimp-r11-ret-int5` (dropped) and `-r12-ret-int5-set` round-trip with `int(5)`, and `lcimp-r22-drop-int3` (a 1-byte symbol) with `int(3)`; with `int(10)` for the symbol of an `int(5)` the first attempt differed in the symbols, which is how the word was found. The operations then have to be the measured ones of the type: a binary of 1, 2 or 4 bytes is widened by `75 8` right after the call (`76 8` for `uns(10)`), the others are not; a dropped result is popped by `3`; a result that a store consumes is the store of a pointer, or `75 S; 75 S; 37 X 0 T` of an `int(5)` or an `int(10)` of the size S. Other kinds and widths (`uns(5)`, a float, a packed result, a stored `int(20)`) have no probe and no verdict. 6. **A call that returns nothing leaves nothing on the stack.** Only the labels and the jumps that end a block follow it: the jump to the end of the procedure (`-r07`), an IF without ELSE (`-r13`, `-r14` in the cycle), the jump over an ELSE (`-r18`). A pop, a compare or any other operation after a call that the symbol says returns nothing refuses; so does a call with a result and no pop or consumer. 7. **A null pointer is `*OMIT` only for a CEE service.** `-d11-null-last` (`fgets(b: 150: *null)`) compiles to the operations of an `*OMIT`; the emit writes `*OMIT` and the feedback code `char(12) options(*omit)` for a name that starts with `CEE` (h-ceeran, `-r07`) and refuses for any other name, and only for the last argument. 8. **`%SIZE(buf)` is not the literal 150.** `lcimp-r03` (`%size(buf)`) and `-r04` (`150`) have the same operations; the round trip of the emit `150` for r03 differs in the creation instructions, the symbols, the literals, the constant area and the initialization. The compiler folds `%SIZE` to the number and leaves a packed constant of that value that no operation loads (`rpg_elem_count.zig`); the literal has none. An integer constant is read as a literal only when the module holds no such constant of its value (`rpg_elem_count.leftByBuiltin`), else the call refuses. A literal that shares its value with a `%SIZE` elsewhere in the module refuses too: which one is which is not proved. 9. **A call of one import has one set of forms.** `lcimp-d15-two-forms` calls `CEEDSHP(n: fc)` and `CEEDSHP(n: *omit)`: the second statement reads as another form of the second parameter than the prototype of the first, and keeps its failure line. `lcimp-d14-copy-const` (`CEEDSHP(5: *omit)` to a CONST `int(10)`) passes the untagged address of a compiler temporary (`37 T; 33 T; 113 q 1`): the site reads a `copy` and the emit keeps the failure line. ## What changed - `rpg_import_site.zig` (new, PURE): the call site. `read` walks the operations of the statement before the frame with the stack walk of `rpg_value_pointer` (now `step`, one operation, and `Item.from`, where a value began) and gives the form of each argument (`reference`, `pointer_value`, `int10_value`, `omitted`, `copy` for the untagged address of a compiler temporary, which keeps the old text of the failure) and the return (from the symbol, and whether a store consumes it). - `int10` takes an integer constant only when `rpg_elem_count.leftByBuiltin` says that no folded builtin left a constant of its value (fact 8), and no other kind of constant. - `rpg_frames.importFrame` reads the four frames (header, call information copy; no argument). `rewrite` refuses a call with no site, and gives the call operation the forms and the return. - `rpg_eval.call` renders each argument by its form: a reference as the data, `%ADDR(x)` or a pointer variable for a value, a number for an `int(10)`. - `Emitter.importCall` reads the same site from the original operations of the statement and writes `Prototype.Parameter.pointer_value` and `.int10_value` and `Prototype.returns`; the prototype writer puts the return type after the name. A second call of one import has to agree with the first in every form and in the return, or it fails. `Emitter.expression` takes the call of an import inside an expression (`p = fgets(...)`; the name may start with `_`). ## Measured The 32 public scout programs (`captures/l10-scout2`, `l10-scout2b`: 33 directories, one program is in both trees and counted once), base v0.1.521 against this build, `capture-emit-diff.sh`: statements 512, emitted 295 to 306, failures 224 to 213 (`runs/lcimp/scout-fix`, the build with the `%SIZE` refusal of fact 8). Six programs change; every changed statement is an import call, and each reads as its source line: | program | emitted | failures | the statements that recover | |---|---|---|---| | barrettotte ifsread | 9 to 11 | 21 to 19 | `fptr = fopen(%addr(fpath): %addr(fmode))`, `fclose(%addr(fpath))` | | adventofcode2025-1 | 31 to 33 | 14 to 12 | `fclose(stream)`, `p_errno = sys_errno()` | | adventofcode2025-2 | 40 to 42 | 25 to 23 | the same two | | adventofcode2025-3, -4 | 15 to 17 | 13 to 11 | the same two, in each | | ossile-6 | 2 to 3 | 12 to 11 | `cee_discardHeap(heapId: *omit)` | 7 of the 15 statements of the triage recover (2 + 1 + 1 + 1 + 1 + 1); the other 8 are the `success = fgets(%ADDR(buffer): %SIZE(buffer): stream)` lines of the four adventofcode programs, which keep their failure line (fact 8: the emit `150` is another object). The four `__errno` statements of the next token recover. The first version of this change emitted those eight as `fgets(%ADDR(buffer): 150: stream)` (emitted 314, failures 205) and was refused in review for it. `agree.sh` over the 32 programs: same 148 to 151, suspect 12 to 12, wrong parameters 0 to 0. The 1347 public captures under `captures/` (the lext import twins, dev5, l10-pgm-a1 and -a2 among them) were measured with the first version: only those six programs changed, and the refusal only takes emitted statements away; the `usleep` twins stay as they were (their `uns(10) value` argument refuses). The committed twins (emit-all over `src/testdata`, base against head): none gets worse; 3 existing twins change: TSELR (`fclose(f)` recovers, the prototype reads as its source), dict-calls3 (the `strcmp` prototype has its `int(10)` return, and `I = cpyr(C: C2)` recovers) and dict-calls4 (a failure line says `CALLP strcat(...)` in place of `unresolved`). h-ceeran, which matches on the host, keeps its text byte for byte, and so does a void CEE call in the cycle (`lcimp-r14`, base and head equal). ## The round trip (host, pub400, `pub-roundtrip.sh` with the build of this change) | twin | shape | verdict | |---|---|---| | r01 | `fclose(f)` dropped, from a procedure | match | | r02 | `rc = fclose(f)` | match | | r03 | `p = fgets(%addr(buf): %size(buf): f)` | refused, a failure line. The emit `150` of the first version was `different`: creation instructions, symbols, literals, constant area, initialization, imports | | r04 | the same with the literal 150 | match | | r05, r08, r09, r10, r06 | `fopen`, a reference, the C library name with a header, `main()`, the cycle | match | | r07, r13, r14, r18 | `CEEDSHP(n: *omit)`, alone, in an IF, in the cycle, before an ELSE | match | | r11, r12 | an `int(5)` dropped and stored | match | | r15, r16, r17 | `__errno` without argument, two calls of one import, an `int(10)` variable | match | | r19, r20, r21 | a dropped `int(20)`, pointer and `uns(10)` | match | | r22 | a dropped `int(3)` | match (run `pub-lcimp-r22-drop-int3-011901`) | `r03` is the folded builtin: `%SIZE(buf)` leaves a packed constant that no operation loads (`rpg_elem_count.zig`), and the literal 150 of `r04` has none. The operations are equal, and the object differs; the first version of this change wrote `150` for both and r03 did not round trip. A constant with such a head is no literal, and the call refuses (fact 8). Eight of the fifteen statements of the triage are this shape; a rule that writes `%SIZE(buf)` for it (the buffer is the field that `%ADDR` names in the first argument) is the next change, not this one. ## Not done, and why - A dropped result of a width without a probe, a result that a compare, a condition or another operation consumes (`lcimp-d10`), an `int(5)`, an unsigned or an `int(20)` value argument (`-d05`, `-d06`, `-d08`), a null that is not the last argument or not of a CEE name (`-d11`), a pointer plus a byte (`29 P 0 T; ...; 62`, untagged), the address of a compiler temporary (`-d14`), a second call of one import whose forms or return differ from the first (`-d15`) and an integer constant that a `%SIZE` or `%LEN` may have left (`-r03`): the site has no verdict, the statement stays a failure line. A null that is not the last argument and a pointer plus a byte are pinned by mutation tests of `lcimp-r07` and `-r01`; every other refusal has a twin. - The `options(*string)` family (`fopen(filename: options)` with characters): the arguments are temporaries of a copy that ends in a zero byte, another family. - `bnddir('QC2LE')` is not in the `ctl-opt` of the emit; the object does not say it. The round trip of a program that calls `_C_IFS_*` needs the binding directory in the compile command (the commands of the committed r twins carry it, `probe.json`). ## For the matrix `lcimp-r01` to `-r22` except `-r03` match on the host. `-r03` keeps a failure line (above), as do the seven refusals (`-d05`, `-d06`, `-d08`, `-d10`, `-d11`, `-d14`, `-d15`) by design: they have a failure line, and some have unused fields and `bnddir` in their `ctl-opt`. None of them can match, and they need a class row (`known_gap`, the reason in this fragment). ## Gate (host round trips, base = ~/bin/sourcerer, the code of v0.1.521) ``` == a. development emits (dev-hash) p1 same p2 same p3 same p4 same p5 same == b. L10-test direction L10-test rose == c. committed twins (emit-bytes-diff) emit text differs: diff -r -x emit.ndjson -x *.receipt.json /Users/someara/data/sourcerer-loop/runs/emitbytes.OmC0Yo/base-emit/151-PB9B6E52BS.rpgle /Users/someara/data/sourcerer-loop/runs/emitbytes.OmC0Yo/head-emit/151-PB9B6E52BS.rpgle 6c6 < dcl-pr A_00262 extproc('strcmp'); --- > dcl-pr A_00262 int(10) extproc('strcmp'); 11a12 > dcl-s A_00267 int(10); 56d56 < 79c79 < // SOURCERER-FAIL statement 79: CALLP strcmp(S256: S266); S267 = strcmp --- > A_00267 = A_00262(A_00256: A_00266); 81c81 < // SOURCERER-FAIL statement 81: CALLP strcat(S256: S266); S268 = strcat --- > // SOURCERER-FAIL statement 81: S268 = strcat(%ADDR(S256): %A... (token: word without a declaration) 87c87 < // sourcerer: recovered source of PB9B6E52BS.PGM; statements 16, emitted 2, failures 14 --- forms projection differs: 36c36 < {"twin":"savf/SC-CONSTRUCT/TSELR","object":"TSELR","status":"done","statements":19,"emitted":15,"failures":4,"lines":57,"form_counts":{"compiler_policy_marks_v1":4,"context_character_literal_v1":4,"context_pointer_store_v1":4,"context_procedure_pointer_store_v1":4,"context_zero_fill_v1":4,"emit_assign_field_v1":4,"emit_ctl_opt_v1":1,"emit_dcl_pi_v1":4,"emit_dcl_proc_v1":4,"emit_dcl_s_v1":4,"emit_end_pi_v1":4,"emit_end_proc_v1":4,"emit_free_v1":1,"emit_pi_parameter_v1":8,"emit_return_value_v1":3,"emit_summary_v1":2,"fail_statement_v1":4,"initialization_entry_v1":4,"initialization_resume_v1":4,"integer_store_v1":4,"layout_blank_v1":14,"local_pointer_store_v1":1,"placeholder_decimal_positions_v1":14,"procedure_end_guard_v1":3,"procedure_exit_transfer_v1":4,"procedure_packed_literal_v1":2,"procedure_return_v1":4},"text_sha256":"eb8c88ef896e0131b54f87afcaf7cb2ab1d2b1c4aad0bbb8ce034203e09c3b83"} --- == d. captures (capture-emit-diff) lcimp-c01-cycle base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lcimp-c02-proc base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c03-main base=[3,2,1] head=[3,3,0] CHANGED fail-lines=0 lcimp-c04-byref base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c05-result base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c06-int20 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c07-clib base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c08-ptr-assigned base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c09-ptr-dropped base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c11-fgets-lit base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c12-fgets-var base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c13-ceedshp base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c14-two-calls base=[6,4,2] head=[6,6,0] CHANGED fail-lines=0 lcimp-c15-local-ptr base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-c16-addr-arg base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-d01-ret-int5 base=[5,4,2] head=[5,5,1] CHANGED fail-lines=1 lcimp-d02-ret-uns10 base=[5,4,2] head=[5,5,1] CHANGED fail-lines=1 lcimp-d03-ret-int3 base=[5,4,2] head=[5,5,1] CHANGED fail-lines=1 lcimp-d04-ret-int5-assigned base=[5,4,2] head=[5,5,1] CHANGED fail-lines=1 lcimp-d11-null-last base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1 lcimp-d12-noargs base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-d13-noargs-int base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r01-drop base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r02-result base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r04-fgets-lit base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r05-fopen base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r06-cycle base=[2,1,1] head=[2,2,0] CHANGED fail-lines=0 lcimp-r07-ceedshp base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r08-byref base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r09-clib base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r10-main base=[3,2,1] head=[3,3,0] CHANGED fail-lines=0 lcimp-r11-ret-int5 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r12-ret-int5-set base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r13-void-if base=[7,6,1] head=[7,7,0] CHANGED fail-lines=0 lcimp-r15-noargs base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r16-two-calls base=[6,4,2] head=[6,6,0] CHANGED fail-lines=0 lcimp-r17-fgets-var base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r18-void-else base=[9,8,1] head=[9,9,0] CHANGED fail-lines=0 lcimp-r19-drop-int20 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r20-drop-ptr base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r21-drop-uns10 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-r22-drop-int3 base=[5,4,1] head=[5,5,0] CHANGED fail-lines=0 lcimp-d15-two-forms base=[6,4,2] head=[6,5,1] CHANGED fail-lines=1 lcimp-e4-const-lit base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1 lcimp-e5-const-int5 base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1 lcimp-e6-const-char base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1 lcimp-d14-copy-const base=[5,4,1] head=[5,4,1] CHANGED fail-lines=1 l10-barrettotte-vscode-ibmi-languages-1 base=[27,9,21] head=[27,11,19] CHANGED fail-lines=19 l10-briangarland-adventofcode2025-1 base=[45,31,14] head=[45,33,12] CHANGED fail-lines=12 l10-briangarland-adventofcode2025-2 base=[65,40,25] head=[65,42,23] CHANGED fail-lines=23 l10-briangarland-adventofcode2025-3 base=[28,15,13] head=[28,17,11] CHANGED fail-lines=11 l10-briangarland-adventofcode2025-4 base=[28,15,13] head=[28,17,11] CHANGED fail-lines=11 l10-ossile-ossile-6 base=[13,2,12] head=[13,3,11] CHANGED fail-lines=11 capture-emit-diff: 102 cases, 53 changed, 44 with no failure line in the head emit == e. source agreement (agree) suspect base=89 head=89 conflict base=0 head=0 params_wrong base=15 head=15 decl_missing base=183 head=183 decl_extra base=27 head=27 type_unmarked base=50 head=50 == f. host round trips (both binaries) cases to round-trip: 44 lcimp-cimport/lcimp-c01-cycle base=different head=different lcimp-cimport/lcimp-c02-proc base=different head=different lcimp-cimport/lcimp-c03-main base=different head=different lcimp-cimport/lcimp-c04-byref base=different head=different lcimp-cimport/lcimp-c05-result base=different head=different lcimp-cimport/lcimp-c06-int20 base=different head=different lcimp-cimport/lcimp-c07-clib base=different head=different lcimp-cimport/lcimp-c08-ptr-assigned base=different head=different lcimp-cimport/lcimp-c09-ptr-dropped base=different head=different lcimp-cimport/lcimp-c11-fgets-lit base=different head=different lcimp-cimport/lcimp-c12-fgets-var base=different head=different lcimp-cimport/lcimp-c13-ceedshp base=different head=different lcimp-cimport/lcimp-c14-two-calls base=different head=different lcimp-cimport/lcimp-c15-local-ptr base=different head=different lcimp-cimport/lcimp-c16-addr-arg base=different head=different lcimp-cimport2/lcimp-d12-noargs base=different head=different lcimp-cimport2/lcimp-d13-noargs-int base=different head=different lcimp-cimport3b/lcimp-r01-drop base=different head=match lcimp-cimport3b/lcimp-r02-result base=different head=match lcimp-cimport3b/lcimp-r04-fgets-lit base=different head=match lcimp-cimport3b/lcimp-r05-fopen base=different head=match lcimp-cimport3b/lcimp-r06-cycle base=different head=match lcimp-cimport3b/lcimp-r07-ceedshp base=different head=match lcimp-cimport3b/lcimp-r08-byref base=different head=match lcimp-cimport3b/lcimp-r09-clib base=different head=match lcimp-cimport3b/lcimp-r10-main base=different head=match lcimp-cimport3b/lcimp-r11-ret-int5 base=different head=match lcimp-cimport3b/lcimp-r12-ret-int5-set base=different head=match lcimp-cimport3c/lcimp-r13-void-if base=different head=match lcimp-cimport3c/lcimp-r14-void-if-cycle base=match head=match lcimp-cimport3c/lcimp-r15-noargs base=different head=match lcimp-cimport3c/lcimp-r16-two-calls base=different head=match lcimp-cimport3c/lcimp-r17-fgets-var base=different head=match lcimp-cimport3c/lcimp-r18-void-else base=different head=match lcimp-cimport3d/lcimp-r19-drop-int20 base=different head=match lcimp-cimport3d/lcimp-r20-drop-ptr base=different head=match lcimp-cimport3d/lcimp-r21-drop-uns10 base=different head=match lcimp-cimport3e/lcimp-r22-drop-int3 base=different head=match dev5/p3 base=match head=match dev5/p4 base=match head=match dev5/p5 base=match head=match l10-scout2b/l10-danlong005-openrpg/l10-danlong005-openrpg-1 base=match head=match l10-scout2b/l10-danlong005-openrpg/l10-danlong005-openrpg-4 base=match head=match l10-scout2b/l10-danlong005-openrpg/l10-danlong005-openrpg-5 base=match head=match gate: PASS ```
The frame of a call that a procedure or main() makes copies the name into its call
information; the cycle does not. The call site gives the form of each argument (a
reference, a pointer value, an int(10) value, *OMIT), and the symbol of the import gives
the type that it returns. The emit writes the prototype from them:
dcl-pr P int(10) extproc('_C_IFS_fclose'). What the object does not tell stays a failure
line.
`fgets(%addr(buf): %size(buf): f)` and `fgets(%addr(buf): 150: f)` compile to the same
operations, but the folded %SIZE leaves a packed constant that no operation loads, and the
emit `150` recompiled to another object. An integer constant is a literal of the call only
when no folded builtin left a constant of its value; the statement keeps its failure line.

The 1-byte return type has its twin now (lcimp-r22, int(3), match on the host), and the
refusals of a copy of a constant (lcimp-d14), of a second call whose forms disagree
(lcimp-d15), of a null that is not the last argument and of a pointer plus a byte each have
a test that fails without the refusal.
Regenerate the operations legend
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
1fec51b77a
sean force-pushed lcimp from 1fec51b77a
Some checks reported errors
binjovi/ci A newer source or plan superseded this Build
to fdb37831a9
All checks were successful
binjovi/ci Binjovi completed the frozen plan
2026-11-15 06:30:11 +00:00
Compare
binjovi-bot manually merged commit fdb37831a9 into trunk 2026-11-15 06:45:06 +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!805
No description provided.