Skip to content

[AUTOMATED] Keep numeric word indexes separate from pointers - #1990

Merged
mahaloz merged 6 commits into
Noelo-Lab:mainfrom
thotypous:kuna-numeric-word-index
Nov 26, 2026
Merged

mahaloz merged 6 commits into
Noelo-Lab:mainfrom
thotypous:kuna-numeric-word-index

Conversation

@thotypous

Copy link
Copy Markdown
Contributor

A CP1600 function returning the number 0x65a7 instead returns the address of a global if that global happens to occupy word 0x65a7.

probe=$(mktemp)
printf '\x02\xb8\x65\xa7\x00\xaf' > "$probe"
kuna decompile "$probe" 0x1000 --addr --raw-image --target CP1600:BE:16:default \
  --base 0x1000 --assert-strict --assert 'data 0x65a7 uint2 cell' \
  --assert 'return %R0 uint2'
rm "$probe"

Before: return (unsigned short)&cell;. After: return 0x65a7;.

Require address-use evidence before inferring a pointer in a word-addressed space. The CP1600 stage case also checks a typed pointer and an indirect load. DecBench (770 binaries) and multi-ISA Debian (146 binaries, 13 ABIs) showed no differences.

Dependency for the Carmel PR (#1936): returning an updated DATA word index must preserve the integer, not take a C object address.

Model: openai-codex/gpt-6.2-sol

thotypous and others added 4 commits November 26, 2026 07:14
An exact symbol match in a word-addressed space is insufficient to treat an integer as a C object address. Keep typed pointers and proven address uses eligible.
… spaces

The address-use requirement also dropped function pointers: on AVR, a
callback passed to an undeclared registration function (reg(1, isr_b))
printed as its word address instead of the function's name. A C function
pointer on these targets is the entry's word address, so an exact function
entry is accepted on the same two readings as the function-entry escape
(the reader is not arithmetic and the function reads the value as a number
nowhere else). Data symbols still need address-use evidence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
@mahaloz

mahaloz commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

[AUTOMATED] Pushed cf3dfdd on top of your commit, then merged main (xml.rs 935, stages baseline re-recorded, +4 assertions).

The address-use requirement also dropped function pointers in word-addressed code spaces. On AVR (avr8:LE:16:default:gcc, raw .text at word 0xd26, functions asserted), add_task(blink, &s, 50) printed R25R24 = blink; before this PR and R25R24 = 0xd56; with it. That changed 10 of 268 functions across 12 clang -O1/-O2/-Os/-Oz images, and every change was a lost callback. On these targets a C function pointer is the entry's word address. So the commit also accepts an exact function entry, under the same two readings as the existing function-entry escape: the reader is not arithmetic, and the function never reads the value as a number. Data symbols still need address-use evidence. The stage gains WORD-INDEX #4 (return helper;), and spec 09 says what counts as evidence.

@thotypous

Copy link
Copy Markdown
Contributor Author

[AUTOMATED] Rechecked b8af1dd55 with the function-entry exception against its base a7aa02855. DecBench (770 binaries): no code, coverage, or score differences. Multi-ISA Debian (146 binaries across 13 ISAs): 28,664 equal successful functions and no A/B differences; both arms hit the same two errors, one in MIPS sort and one in RV32 openssl. This remains a dependency of the Carmel PR (#1936).

@mahaloz
mahaloz merged commit 64a81b6 into Noelo-Lab:main Nov 26, 2026
2 checks passed
mahaloz added a commit to phix33/kuna that referenced this pull request Nov 26, 2026
Main moved to 64a81b6 (Noelo-Lab#1990 added a stage). The corpus count auto-merges to
936, and docs/baseline-stages.json is re-recorded on the merged tree: 5,542
assertions, main's 5,540 plus this PR's two new elfv1-symbolextent assertions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants