From 6c03bcfdf0df8460881589265df174c7c68b8730 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Tue, 27 Oct 2026 06:58:50 -0500 Subject: [PATCH] fix(omc): a long function name is never a keyword by its first 8 bytes The token word tw packs only the first 8 bytes of a name. s_fn asked kw about tw for any name up to 63 bytes, so a 9..63-byte name whose first 8 bytes spell an 8-byte keyword (continue_x, truncate_number) was refused error 16. s_fn now asks kw only when tl <= 8, as typeword, topname, the statement start and ir_newname already do; s_field tests the length (13) before the keyword (16), so an over-long field name is reported as long. Every other kw site is guarded by tl <= 8 or compares against a keyword shorter than 8 bytes. Regression: s1 rows kw-long-names and kw-long-om1 (defined, called in a value and as a statement, two such names told apart; exit 0), bad-kw-name (exact keyword, still 16), bad-kw-field (13). Mutant m-kwlong removes the guard and is caught. Compiler 2c824805 fails three of the four rows (exit 16). Source only; the batch integrator reseeds seed/out/omc. --- .crumb | 16 +++++++-------- CONTRIBUTORS.md | 1 + docs/.crumb | 34 ++++++++++++++++---------------- docs/one_layer/OMEGESE.md | 4 +++- seed/omc/om2/s1/bad-kw-field.om | 5 +++++ seed/omc/om2/s1/bad-kw-name.om | 8 ++++++++ seed/omc/om2/s1/kw-long-names.om | 25 +++++++++++++++++++++++ seed/omc/om2/s1/kw-long-om1.om | 24 ++++++++++++++++++++++ seed/omc/om2/s1/mut/kwlong.from | 7 +++++++ seed/omc/om2/s1/mut/kwlong.to | 5 +++++ seed/omc/om2/s1/s1-mutants.cases | 5 +++++ seed/omc/om2/s1/s1.cases | 5 +++++ seed/omc/omc.om | 9 ++++++--- 13 files changed, 119 insertions(+), 29 deletions(-) create mode 100644 seed/omc/om2/s1/bad-kw-field.om create mode 100644 seed/omc/om2/s1/bad-kw-name.om create mode 100644 seed/omc/om2/s1/kw-long-names.om create mode 100644 seed/omc/om2/s1/kw-long-om1.om create mode 100644 seed/omc/om2/s1/mut/kwlong.from create mode 100644 seed/omc/om2/s1/mut/kwlong.to diff --git a/.crumb b/.crumb index f62f2f33c..a1fce3ac2 100644 --- a/.crumb +++ b/.crumb @@ -47,8 +47,8 @@ "purpose": "Directory calibration. Purpose not yet described by a human." }, { - "digest": "26c2fbf4515e981db72f56dad2fc3fe0667c469551cf6071e28ac50005a36e42", - "last_commit": "943f5139f", + "digest": "af982ec5492c68fb07e125f1e1edcbc60c46e719a75a0f53c59c2a411073f3bd", + "last_commit": "e211589f9", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -95,15 +95,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:534f796d8e0fc81c75e714b05cf9bf36f60f0b5d31d5430fdea52d8bf179e6ea", - "compiled_at": "2026-10-27T00:45:25Z", + "children_root": "sha256:013fe28ff533012b89566e3b7e3ae92831ec6f34cf6d3bded8622653f9c96280", + "compiled_at": "2026-10-27T11:59:00Z", "compiler": "crumb-compile/1", - "digest": "sha256:fcb2fe9e59c8b7feeffedb41f1ae7cb713c34e33e1985e5aad1d473df75567f0", + "digest": "sha256:1eaa060751d3d353aa24730f5da7bf80e39f6b48bb74580e78f947782738692e", "evidence_files": 12477, "evidence_root": "sha256:9d96c8c22e5c574c4768d1eadd333b9750f73cd27be276a0f190c876960008a1", - "files": 17302, - "generated_at_commit": "52eba8831aa0b8db9fa2f2e13289920be4fa85f6", - "source_tree": "sha256:cd64f35f93a5dbeb923558fcae52ddcc8b82be786c4ca2e84e4d0a61ec07dcd6" + "files": 17308, + "generated_at_commit": "e211589f900c5fa0a3ba4fab75df211bcf07fb30", + "source_tree": "sha256:9336395a542b05d0ad2edf58e3fb09727855c2df2805e1208b2d71ae7bd503d6" }, "owner_lane": "", "provenance": { diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fb8cb6227..b10be7d78 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -32,3 +32,4 @@ This table starts with the numeric work on this branch. Earlier work in this rep Update this table in the same commit as the work it credits. | Claude Opus 5.5 | Seed-chain bootstrap challenge: `seed/challenge/run.sh` rebuilds omc from the 408-byte seed out of a pinned `git archive` and checks every input and rung against a table read from committed files, with tampered-rung and wrong-value negative controls | +| Claude Opus 5.5 | Seeded compiler: a function name of 9..63 bytes whose first 8 bytes spell a keyword (`continue_x`, `truncate_number`) accepted instead of refused error 16, and an over-long field name reported as error 13 before the keyword test; s1 regression rows, a reintroducing mutant and the 2c824805 negative control | diff --git a/docs/.crumb b/docs/.crumb index dcf015737..609a9b216 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -46,92 +46,92 @@ "children": [ { "digest": "640f6b7b818c769ab0dcd91437d58dd3251044084d2ae3785f000d30d2bb768a", - "last_commit": "a927bd6c", + "last_commit": "a927bd6c2", "name": "adr", "purpose": "Directory docs/adr. Purpose not yet described by a human." }, { "digest": "e7ac2460455a35b96b01dab649dcdc2cdf5bb4657bf230b91272c64fe1bf82cf", - "last_commit": "d48ab89e", + "last_commit": "d48ab89e5", "name": "autodiff", "purpose": "M21 OMEGA_AUTODIFF scope, op and error-contract table, status (not qualified)" }, { "digest": "7506b1a8659e6de84e1be31a281c8d046e4946de6ed29451155bb56cda5cb365", - "last_commit": "6637b32b", + "last_commit": "6637b32b6", "name": "brownian", "purpose": "Directory docs/brownian. Purpose not yet described by a human." }, { "digest": "1b01542d91e3b1c7c5263d6b393338a3d9d40e138a12ec833ce7852d83887ce2", - "last_commit": "5901baa5", + "last_commit": "5901baa51", "name": "crumbs", "purpose": "Directory docs/crumbs. Purpose not yet described by a human." }, { "digest": "e9baaaeec04be41a57c4a2d6a540b01a682c70d4db96cb4af4e1a9912a133aa9", - "last_commit": "55d05d6a", + "last_commit": "55d05d6a5", "name": "dual", "purpose": "DUAL (ARCH-0031) documents in omega: applicability experiment method and findings (APPLICABILITY" }, { "digest": "56a5a999ce726e90d89c1c88b9e20c81857c8e6ee82af8d651ac80ea70e2c46d", - "last_commit": "38a6a569", + "last_commit": "38a6a569b", "name": "estimation", "purpose": "Directory docs/estimation. Purpose not yet described by a human." }, { "digest": "8b926a045985692f116d9469af5aaa06d778bca78cf5d7e891e68c2486ed789e", - "last_commit": "8ec82485", + "last_commit": "8ec82485d", "name": "numeric", "purpose": "Directory docs/numeric. Purpose not yet described by a human." }, { "digest": "1a26b15f795aa3581a03400a21d5635e85c71f3f544fcc3676fa58064402c7ad", - "last_commit": "968734c7", + "last_commit": "968734c7e", "name": "osc", "purpose": "Directory docs/osc. Purpose not yet described by a human." }, { "digest": "645b6abb9d46a13dff6c9091d79acf0318fcfdc447a2dc50a3b70cd0dcfaa548", - "last_commit": "968734c7", + "last_commit": "968734c7e", "name": "polyglot", "purpose": "Directory docs/polyglot. Purpose not yet described by a human." }, { "digest": "46d3e2d59a468271e044ccd2398eb32345df6436c15eb6d8c703953c838023a9", - "last_commit": "dd67f6bd", + "last_commit": "dd67f6bd7", "name": "reservoir", "purpose": "Reservoir reference and contracts (omega#440): RESERVOIR_REFERENCE.md pins the authors' paper an" }, { "digest": "2ab37838f8694e5060a3789f08a16146996050af949fba329ed805429d85f695", - "last_commit": "f633e343", + "last_commit": "f633e3430", "name": "tensor", "purpose": "M20 OMEGA_TENSOR spec and qualification checklist" }, { "digest": "41ab5cf8617e9583dcda75292e1e851e1ec4187b69d5d00b5eb354f1ee55c9d5", - "last_commit": "54826a37", + "last_commit": "54826a37f", "name": "train", "purpose": "Directory docs/train. Purpose not yet described by a human." }, { "digest": "5db2869ff0b78866ad0ce38f77b262e81fdbc89408e94968491c4e6548177278", - "last_commit": "968734c7", + "last_commit": "968734c7e", "name": "turing", "purpose": "Directory docs/turing. Purpose not yet described by a human." } ], "children_root": "sha256:c81d43c0c392dfec2b6ed5b38ba95ea7c592782b283950e32b777e7b9cfd9d61", - "compiled_at": "2026-10-26T17:56:57Z", + "compiled_at": "2026-10-27T11:58:49Z", "compiler": "crumb-compile/1", - "digest": "sha256:26c2fbf4515e981db72f56dad2fc3fe0667c469551cf6071e28ac50005a36e42", + "digest": "sha256:af982ec5492c68fb07e125f1e1edcbc60c46e719a75a0f53c59c2a411073f3bd", "evidence_files": 34, "evidence_root": "sha256:589d8b3706e6d7a202ab20b278dac5fc5bafc973f1c2a867b2668aa7210b65cc", "files": 135, - "generated_at_commit": "943f5139f3f91f586ca03e707332afb2048d59d2", - "source_tree": "sha256:e91c9c4dc91d9680759d217e532ccacbaceea2f0ae8acc0b1ee957e627f1381d" + "generated_at_commit": "e5b32567a7aff3ce594e3254a622a846a6cd190b", + "source_tree": "sha256:5465f7e01fbdf986ae12ba088f02a154c228d552fdcb2d27e3d1d89ac5e9a615" }, "owner_lane": "", "provenance": { diff --git a/docs/one_layer/OMEGESE.md b/docs/one_layer/OMEGESE.md index 119c55955..253f95da2 100644 --- a/docs/one_layer/OMEGESE.md +++ b/docs/one_layer/OMEGESE.md @@ -420,7 +420,9 @@ gate that tests it (`seed/rung4/gate4.sh`, section numbers of that script). Deci - `to void` makes a void function; `ret` with no value returns from it, and so does reaching its `end`. A function with a return type whose `end` can be reached is error 18. (s.6 t_void, s.7) - Arguments are read left to right, each fully before the next. (s.5 fm5) -- Function names may have up to 63 characters; other names up to 8 (error 13). (s.4 dev01, s.7) +- Function names may have up to 63 characters; other names up to 8 (error 13). (s.4 dev01, s.7) A + function name longer than 8 characters is never a keyword, even when its first 8 spell one + (`continue_x`, `truncate_number`); a name that is exactly a keyword is error 16. (s1 kw-long-names) - A function has at most 6 parameters; a seventh is error 9. `main` has none (error 9). A new name may not reuse a name already in scope, a function or a struct: error 10. - In program mode the stack is a fixed 8 MiB pool; a call or a local array that would go below it traps diff --git a/seed/omc/om2/s1/bad-kw-field.om b/seed/omc/om2/s1/bad-kw-field.om new file mode 100644 index 000000000..c9b7cd700 --- /dev/null +++ b/seed/omc/om2/s1/bad-kw-field.om @@ -0,0 +1,5 @@ +note S1: a field name over 8 bytes is error 13 (too long), also when its first 8 bytes spell a keyword. +struct S continue_x ulong end +fn main to int +ret 0 +end diff --git a/seed/omc/om2/s1/bad-kw-name.om b/seed/omc/om2/s1/bad-kw-name.om new file mode 100644 index 000000000..68a54409f --- /dev/null +++ b/seed/omc/om2/s1/bad-kw-name.om @@ -0,0 +1,8 @@ +note S1: a function name that is exactly a keyword (continue) stays error 16. +om2 +fn continue to long +ret 1 +end +fn main to int +ret 0 +end diff --git a/seed/omc/om2/s1/kw-long-names.om b/seed/omc/om2/s1/kw-long-names.om new file mode 100644 index 000000000..2a83211ac --- /dev/null +++ b/seed/omc/om2/s1/kw-long-names.om @@ -0,0 +1,25 @@ +note S1: a function name of 9..63 bytes whose first 8 bytes spell an 8-byte keyword (continue, truncate) +note is a name, not that keyword: defined, called in a value, called as a statement, two of them told +note apart in full. Exit 0, else the failing check's number. +om2 +fn continue_x a long to long +ret add a 1 +end +fn continue_y a long to long +ret add a 2 +end +fn truncate_it to void +ret +end +fn main to int +x = continue_x 3 +if ne x 4 +ret 1 +end +y = continue_y 10 +if ne y 12 +ret 2 +end +truncate_it +ret 0 +end diff --git a/seed/omc/om2/s1/kw-long-om1.om b/seed/omc/om2/s1/kw-long-om1.om new file mode 100644 index 000000000..2458f270e --- /dev/null +++ b/seed/omc/om2/s1/kw-long-om1.om @@ -0,0 +1,24 @@ +note S1 (OM-1 unit): a function name of 9..63 bytes whose first 8 bytes spell an 8-byte keyword (continue, truncate) +note is a name, not that keyword: defined, called in a value, called as a statement, two of them told +note apart in full. Exit 0, else the failing check's number. +fn continue_x a long to long +ret add a 1 +end +fn continue_y a long to long +ret add a 2 +end +fn truncate_it to void +ret +end +fn main to int +x = continue_x 3 +if ne x 4 +ret 1 +end +y = continue_y 10 +if ne y 12 +ret 2 +end +truncate_it +ret 0 +end diff --git a/seed/omc/om2/s1/mut/kwlong.from b/seed/omc/om2/s1/mut/kwlong.from new file mode 100644 index 000000000..cf3203eea --- /dev/null +++ b/seed/omc/om2/s1/mut/kwlong.from @@ -0,0 +1,7 @@ +w = get tw 0 +if le get tl 0 8 +if ne kw w 0 +fail 16 +end +end +l = get tl 0 diff --git a/seed/omc/om2/s1/mut/kwlong.to b/seed/omc/om2/s1/mut/kwlong.to new file mode 100644 index 000000000..accd928f8 --- /dev/null +++ b/seed/omc/om2/s1/mut/kwlong.to @@ -0,0 +1,5 @@ +w = get tw 0 +if ne kw w 0 +fail 16 +end +l = get tl 0 diff --git a/seed/omc/om2/s1/s1-mutants.cases b/seed/omc/om2/s1/s1-mutants.cases index defc5d97e..f60be7170 100644 --- a/seed/omc/om2/s1/s1-mutants.cases +++ b/seed/omc/om2/s1/s1-mutants.cases @@ -8,6 +8,7 @@ ctl-rot-trap run seed/omc/om2/s1/rot-trap-var.om - - - 107 ctl-hex-max run seed/omc/om2/s1/hex-max.om - - - 0 ctl-hex-upper refuse seed/omc/om2/s1/bad-hex-upper.om 6 ctl-om1-names run seed/omc/om2/s1/om1-names.om - - - 2 +ctl-kw-long-names run seed/omc/om2/s1/kw-long-names.om - - - 0 ctl-fmt emit seed/omc/om2/s1/fmt-in.om file:seed/omc/om2/s1/fmt-out.txt - 0 ctl-diag-unknown emit seed/omc/om2/s1/diag-unknown.om - file:seed/omc/om2/s1/diag-unknown.err 3 ctl-diag-newpt emit seed/omc/om2/s1/diag-newpt.om - file:seed/omc/om2/s1/diag-newpt.err 16 @@ -43,3 +44,7 @@ m-unk emit seed/omc/om2/s1/diag-unknown.om - file:seed/omc/om2/s1/diag-unknown.e subst seed/omc/om2/s1/mut/tyunk.from seed/omc/om2/s1/mut/tyunk.to cc seed/omc/omc.om m-tyunk emit seed/omc/om2/s1/diag-newpt.om - file:seed/omc/om2/s1/diag-newpt.err 16 +# fn name: the keyword test applied to the first 8 bytes of a name of 9..63 bytes (continue_x read as continue) +subst seed/omc/om2/s1/mut/kwlong.from seed/omc/om2/s1/mut/kwlong.to +cc seed/omc/omc.om +m-kwlong run seed/omc/om2/s1/kw-long-names.om - - - 0 diff --git a/seed/omc/om2/s1/s1.cases b/seed/omc/om2/s1/s1.cases index c0dd85b7e..69b171931 100644 --- a/seed/omc/om2/s1/s1.cases +++ b/seed/omc/om2/s1/s1.cases @@ -54,3 +54,8 @@ s1-bad-fmt-compile emit seed/omc/om2/s1/bad-fmt-compile.om - err:3:5 5 s1-diag-newpt emit seed/omc/om2/s1/diag-newpt.om - file:seed/omc/om2/s1/diag-newpt.err 16 s1-diag-viewpt emit seed/omc/om2/s1/diag-viewpt.om - file:seed/omc/om2/s1/diag-viewpt.err 16 s1-bad-fmt-crtext emit seed/omc/om2/s1/bad-fmt-crtext.om - err:4:6 6 +# a name of 9..63 bytes is never a keyword: only its first 8 bytes are packed (continue_x is not continue) +s1-kw-long-names run seed/omc/om2/s1/kw-long-names.om - - - 0 +s1-kw-long-om1 run seed/omc/om2/s1/kw-long-om1.om - - - 0 +s1-bad-kw-name refuse seed/omc/om2/s1/bad-kw-name.om 16 +s1-bad-kw-field refuse seed/omc/om2/s1/bad-kw-field.om 13 diff --git a/seed/omc/omc.om b/seed/omc/omc.om index eed86971c..4b4ab72ad 100644 --- a/seed/omc/omc.om +++ b/seed/omc/omc.om @@ -6666,6 +6666,7 @@ fn_tail f end note s_fn: fn name (param type | param view T N | param edit T N)* to type | void. om4 S_FN. +note A name of 9..63 bytes is never a keyword: tw packs only its first 8 bytes (continue_x is not continue). fn s_fn to void if ne get curret 0 0 fail 15 @@ -6678,9 +6679,11 @@ if gt get tl 0 63 fail 13 end w = get tw 0 +if le get tl 0 8 if ne kw w 0 fail 16 end +end l = get tl 0 s = get ts 0 f = ulong 0 @@ -8755,12 +8758,12 @@ end note s_field: the current word is a field name of struct w. Returns the cell count after this field. fn s_field w ulong fo ulong cells ulong to ulong -if ne kw get tw 0 0 -fail 16 -end if gt get tl 0 8 fail 13 end +if ne kw get tw 0 0 +fail 16 +end fw = get tw 0 if eq fw w fail 10