Repository navigation
[AUTOMATED] feat(p5): ptrfromuse void by default - #690
Merged
Merged
Conversation
A pointer-width parameter whose every use in the body is a dereference is now declared `void *` instead of `long`, and with `protoorder` a function that only forwards such a pointer is declared with `void *` too. Field accesses keep their byte arithmetic with a cast on the base (`*(long *)((long)a0 + 8)`); `--option ptrfromuse off` restores the integer declaration and the uncast arithmetic. Measured on this base: 444-slice type sweep 1,147 -> 1,351 perfect type_match (+204), aggregate +232.71, 85 more improved, 0 worse (`byte` is +7); on four firmware images 216 = 216 perfect, 30 improved and 7 worse, all seven betaflight bus callbacks the program declares `uint32_t arg` and casts to a device pointer in their first statement. Arity, call arguments and variable counts are unchanged over 4,490 corpus functions; 836 of them change, all declarations, casts, reordered sums and two address-temporary folds; speed worst +2.09% (pooled min-of-30, budget +5%). 13 stage assertions, one kuna-cli test and four CLI probes pinned a dereferenced-only parameter's old spelling and follow the new one. Evidence: docs/features/ptrfromuse/default-on-evaluation.md. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz
force-pushed
the
feat/ptrfromuse-on
branch
from
September 20, 2026 03:40
dfab809 to
1b25d39
Compare
mahaloz
added a commit
that referenced
this pull request
Sep 20, 2026
…d speed after the body clause 770 binaries re-swept: identical DIFF set (21), every hunk identical except e2fsck's int8 -> void * which is #690 on the base. Arity counters on the JSON variables[] surface across the 21 changed binaries: 23,510 functions, 0 gained/lost, 47,887 arg rows in both arms, 0 functions with a changed arg or variable-row count. Typesweep 444 slices 1351 -> 1351, 0/0. Speed interleaved min-of-15 worst +0.47%. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
mahaloz
added a commit
that referenced
this pull request
Sep 20, 2026
…d speed after the body clause 770 binaries re-swept: identical DIFF set (21), every hunk identical except e2fsck's int8 -> void * which is #690 on the base. Arity counters on the JSON variables[] surface across the 21 changed binaries: 23,510 functions, 0 gained/lost, 47,887 arg rows in both arms, 0 functions with a changed arg or variable-row count. Typesweep 444 slices 1351 -> 1351, 0/0. Speed interleaved min-of-15 worst +0.47%. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG
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
A pointer-width parameter that a function only ever dereferences is declared
long, so everyfield access through it prints as integer arithmetic and the declaration says nothing. The
qsort-style wrappers that only forward such a pointer inherit the samelong:--option ptrfromuse voidalready prints both as(void *a0,void *a1), which is what thesource declares. This makes that the default.
The change
ptrfromusedefaults tovoid(wasoff). Field accesses keep their byte arithmetic with acast on the base (
*(long *)((long)a0 + 8));--option ptrfromuse offrestores the integer.voidoverbyte: on the 444-slice decbench type sweepvoidmoves 204 functions onto aperfect
type_matchand 85 more up,byte7 and 21, and neither moves any function down.What
voidwins is thevoid const *callbacks —ls's sort comparators and gnulib's hashand comparator callbacks — reached through
protoorderfrom the callee that dereferences thepointer.
its first statement: seven betaflight bus callbacks (
busStatus_e mpuIntCallback(uint32_t arg))go from 0.0 to a worse score on four firmware images, against 30 that improve. That ambiguity
is what the option's
use_whennames.The tests
make test675/675 unchanged;make test-stages1250/1250 (13 assertions and 1 cargo testpinned a dereferenced-only parameter's spelling and follow the
void *one — the read-before-storeorder
ALIASOVERLAPasserts does not move);make test-cli209/209 with one new probe,ptrfromuse-default-declares-a-dereferenced-parameter-void.sums and two address-temporary folds; no argument, variable, call or load-order change) and speed:
docs/features/ptrfromuse/default-on-evaluation.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01YFCA715QE6ZBSnTn7bwabG