Fix function pointer assignment - #328
Open
ChAoSUnItY wants to merge 1 commit into
Open
Conversation
This patch fixes function pointer assignment on local variable, direct struct member, and pointer-to-struct member, and also fixes in-register arguments not cleared after invocation of function pointer.
ChAoSUnItY
force-pushed
the
fix/fp-assign
branch
from
August 25, 2026 09:07
aa3fb4f to
0e76361
Compare
DrXiao
reviewed
Aug 26, 2026
| opstack_push(vd); | ||
| add_insn(parent, *bb, OP_read, vd, rs1, NULL, PTR_SIZE, NULL); | ||
|
|
||
| if (lvalue.is_reference) { |
Collaborator
There was a problem hiding this comment.
How about adding some comments?
| rs2 = opstack_pop(); | ||
| rs1 = opstack_pop(); | ||
|
|
||
| if (!lvalue.is_reference) { |
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.
This patch fixes function pointer assignment on local variable, direct struct member, and pointer-to-struct member, and also fixes in-register arguments not cleared after invocation of function pointer.
Summary by cubic
Fixes incorrect function-pointer assignment and cleans up register liveness after indirect calls to prevent wrong-address reads/writes and spill corruption. Previously locals and struct members could target the wrong address and call-argument registers stayed live after function-pointer calls; now locals invoke the pointer directly, member stores target the base address, and registers are cleared post-call.
Bug Fixes
Written for commit 0e76361. Summary will update on new commits.