Repository navigation
[AUTOMATED] fix(p3,p6): a struct parameter split between registers and the stack is printed as overwritten - #863
Merged
Merged
Conversation
…rs and the stack whole WIP: heritage splits a mixed-space join at the first pass that heritages any piece; every join parameter's symbol is restricted to the function input. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
…V; spec prose Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
mahaloz
force-pushed
the
fix/split-struct-param
branch
from
October 2, 2026 23:52
5ebd1fd to
c797915
Compare
mahaloz
added a commit
to phix33/kuna
that referenced
this pull request
Oct 3, 2026
Brings in Noelo-Lab#863 (split struct parameters); no conflicts, no new options or stage tests. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt
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
On ARM, MIPS and RISC-V, a by-value struct parameter whose fields span registers and the stack is printed as assigned to when the function reuses one of its registers, and copying its register fields to memory is dropped.
d1passessunchanged in r0-r2 and*kin r3.d4storess.xands.ynext tos.zbefore passing&v1. With this change they printk_00 = *k; return take3(s,k_00) + a;andv1.z = s.z; v1.y = s.y; v1.x = s.x;.The fix
Not fixed: when the function stores the register fields just below the stack part and passes pointers into the result to a call (gcc and clang do this when the parameter's address is taken), the stack part still prints as a separate local, and a value the call writes through a pointer is read back from that local (#861). AArch64 should never split such a struct (#859).
Tests
split_struct_params.rsdecompiles the two functions above for ARM and MIPS o32, and a RISC-V lp64d struct held ina7and the stack whosea7is reloaded for a call. All five fail on main.decompile-allover 14 stripped binaries (4,315 functions) is byte-identical. Over 10 unstripped ARM firmware images, where DWARF supplies the prototypes, 3 functions change:fopencookieand_fopencookie_rlosefunctions.seek = functions.seek;lines and a field-by-field copy, andgyroReadSensorTemperatureis the case above. Decompile-all time, interleaved min of 15: +0.9% (chibios with DWARF), -2.7% (nuttx), +0.7% (cat).Fixes #814
🤖 Generated with Claude Code
https://claude.ai/code/session_012UUBmGqZTcD5N8LxpVsiQt