Repository navigation
[AUTOMATED] feat(p4): drop a trailing register argument a call clobber put there - #652
Merged
Merged
Conversation
mahaloz
force-pushed
the
feat/phantomargs
branch
3 times, most recently
from
September 17, 2026 00:48
3c52f42 to
7008707
Compare
…r put there (argclobber) Rebased onto origin/main (32b2518). Counter sites re-derived on a freshly built tree, the catalog fixture re-captured and the stages baseline re-recorded rather than hand-merged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…s an argument A MULTIEQUAL input that was not an indirect creation was skipped outright, so one clobber among a join's incoming values condemned the whole join and a value the caller demonstrably wrote on another path -- a constant, or the caller's own parameter -- was deleted with it. Every other input must now be positively classified as a division by-product, which is the evidence upstream itself scores this way on the return side. Re-cuts the positive stage fixture (its non-clobber path wrote `mov $0x7,%edx`, a value the caller really wrote) onto the fmt witness's real shape: a call clobber on one path and a dead idiv remainder on the other. Adds kuna-argclobber-forward.xml for the parameter-forwarding negative. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…ect the shipped claims The whole-corpus sweep is re-run on the tightened rule and extended with the ARM/RTOS family the first one skipped (crazyflie, cleanflight, nuttx, chibios, freertos) plus gnutls, sysvinit and two -O0 builds: 46 binaries, 41,258 functions, 4 changed functions, all one shape. Two sentences that the earlier sweep artifact itself contradicted are replaced by measurements: the variables[] rows are identical on 3 of 4 changed functions (the fourth gains a typed slot), and the arity claim is re-measured on the sites that still fire. The blind-spot disclosure in the spec chapter, phases.toml, modes.rs and docs/modes.md now names the join as a clause rather than a gap. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…pros Each builds with gcc -nostdlib -static and is read with kuna decompile-all, so the positive case and both negative clauses can be reproduced without the decbench corpus. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…ression Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…shipping Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…rgclobber text change catalog_bytecompat pins the `phase catalog` bytes verbatim, so a settable's summary/use_when text moves it. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
fmt main -0.61%, a 1,000-line control -0.05% (min of 21 interleaved pairs). The +2.03% recorded earlier was the workspace suite running underneath. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…fmain settables 209 -> 210, tiers (67,80,62) -> (68,80,62), catalog rows 209, stage corpus 299; phase_catalog.json recaptured, docs/options.md regenerated and docs/baseline-stages.json re-recorded (1029 keys) rather than hand-merged. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
…ebased tree The corpus sweep is unchanged after the rebase onto elfmain (46 binaries / 41,258 functions / 4 changed), and the default-ON ablation is re-run against the re-recorded stages baseline: 675/675 and 1029/1029, both PARITY OK. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29
mahaloz
force-pushed
the
feat/phantomargs
branch
from
September 17, 2026 02:02
619862c to
4a907d0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
kuna hands a call an argument nobody passed. The caller below clobbers
rdxonone path and leaves an
idivremainder in it on the other, andtargetgets athird argument built out of the two:
In the field it costs a whole variable chain. coreutils
fmt-O2 calls onestatic function three times with three different arities, the longest reading two
// rdxlocals that are assigned nowhere, against a DWARF prototype of twoparameters.
The register is a possible output location of the callee's model, so
Heritage::guardCallsplants an INDIRECT creation for it,AncestorRealisticanswers realistic and records
isIndCreateFormed, and every active trial ismarked used. Upstream reads that bit back on the return list only
(
ParamListStandardOut::fillinMap,fspec.cc:1721) — the input list has no suchtest, which is why stock Ghidra emits the same call and names the phantom
extraout_RDX.The fix
argclobber(P4, default off): score the trailing registerargument no-use when nothing on the caller's side put a value in its register.
indirect creation feeding the trial has to be a creation of the argument
register itself (a preceding call's result is an indirect creation too, so
a value the caller moved into an argument register is not a clobber); every
other input of that join has to be a division by-product, because one clobber
among a phi's inputs says nothing about the other paths; and the callee's own
body must not read those bytes before writing them, which is also what
answers for a callee kuna never recovered as variadic.
returns a 16-byte value in
rax:rdxand forwards the high half. It is out ofAGGRESSIVE_OVERRIDESfor the same reason, and because a wrong drop deletes anexpression rather than producing a visibly odd one.
The tests
Four stage cases: the bug/fix pair above, plus one per guard clause — a callee
that reads
rdx, an ARM caller that moves a return value intor3(u-boot'sprintf("… value %u!\n", …)reduced), and a caller that forwards its own secondparameter on the non-clobber path. All three negatives must render the same call
in both passes.
Whole-corpus
decompile-allsweep, off vs on, 46 stripped binaries / 41,258functions across 21 x86-64 projects and 8 ARM images: 4 functions change, each
losing exactly one trailing argument, and all four are the shape above. Each
lands on its callee's own recovered arity and on an external prototype —
fmt(FILE *, char const *)by DWARF,ext2fs_dblist_sort2(dblist, sortfunc)andxrealloc(void *, size_t)by their headers. Thevariables[]rows decbenchscores are identical on three of the four; the fourth gains a typed
char *where an uncommitted
undefined8slot was, and nokind: argrow is deletedanywhere. Details in
docs/features/phantomargs/.Gates:
make test675/675 PARITY OK,make test-stages1029/1029 PARITY OK,make test-cli178/178,make check-spec+--strict,kuna catalog --check,counters --checkclean,make rust-testgreen.🤖 Generated with Claude Code
https://claude.ai/code/session_01MAeimyWm5oSewpeCgAwY29