Skip to content

Add opt-in range proof for Thumb byte-loop decrement flags - #409

Merged
MatyMeatBoy merged 1 commit into
claude/rom-decompilation-research-obsal6from
codex/sdk-loop-cc-20261104
Nov 4, 2026
Merged

MatyMeatBoy merged 1 commit into
claude/rom-decompilation-research-obsal6from
codex/sdk-loop-cc-20261104

Conversation

@MatyMeatBoy

Copy link
Copy Markdown
Owner

A zero comparison after a loop decrement is redundant only when signed overflow is impossible. Add default-off -fthumb-loop-cc-reuse to the isolated SDK compiler, requiring base CC reuse. Production module flags remain unchanged.

The proof requires a nonvolatile unsigned-byte seed before a single-entry bounded region, no counter changes except SUB #1, and a signed GT repeat edge. A whole-function audit rejects outside entries into region labels and unknown indirect control flow. Full-INSN register-set checks include writeback. Region, seed and function scans have fixed bounds, and both successors must prove old carry unobserved. Induction bounds each decrement result to -1..254, making NZV equal to CMP(result,0); arbitrary word counters at INT_MIN are excluded.

Validation: separately hashed patch and fresh zero-fuzz installation; six profiles totaling 385,056 execution cases, all byte seeds and incoming NZCV, return PC/SP/r4-r11 and memory. Negative controls cover word/INT_MIN counters, changed counters, inner-label entries, body/exit ASM, volatile seeds, real C calls and budget exhaustion. A spinning negative control must fail return validation. Reference bytes are unchanged with the option off or without base reuse. The existing 563,760 CC cases, normal ROM compare, NONMATCHING build, tree check and three strict SDK oracles pass. Normal and NONMATCHING engine objects remain byte-identical with production flags.

A private full-module ply_note candidate reaches 538 bytes versus the original 536: its extra loop comparison is removed, but literal-pool placement still differs. It remains NONMATCHING; this compiler PR adds no matching credit and enables no production flag.

Prove a byte seed, one counter decrement and a guarded repeat edge before reusing signed SUB flags. Audit outside entries, counter changes and both-path carry liveness within fixed bounds. Add runtime and exclusion fixtures without changing production module flags.

Co-Authored-By: Codex <noreply@openai.com>
@MatyMeatBoy
MatyMeatBoy merged commit ee44a1e into claude/rom-decompilation-research-obsal6 Nov 4, 2026
4 checks passed
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.

1 participant