-
Notifications
You must be signed in to change notification settings - Fork 99
darwin: Fix darwin int string mixing #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
darwin: Fix darwin int string mixing #357
Conversation
b5d5bfe to
72a33da
Compare
hajimehoshi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem a lot of TODOs. Is this intended?
|
I'll open a separate PR with the test generation code. I'm finding a host of darwin abi incompatibilities and opted to start generating the tests. |
Add test case that verifies multiple string arguments passed on the stack each receive their correct distinct values, rather than all receiving the same duplicated value. This test catches the bug fixed in the previous commit where v.String() was incorrectly used instead of val.String().
Use the correct loop variable 'val' instead of 'v' when converting string arguments to C strings. This ensures each string argument is properly converted rather than repeatedly using the same outer scope variable.
72a33da to
27c814f
Compare
hajimehoshi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@TotallyGamerJet Please take a look
|
note: This change is included in #353 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where multiple string arguments passed on the stack were receiving duplicate values instead of their correct individual values. The issue was caused by using the outer loop variable instead of the inner loop variable when converting strings to C strings.
- Fixed incorrect variable reference in string conversion loop (line 290 of func.go)
- Added C test function
test_8i32_3stringsto verify multiple strings on stack work correctly - Added corresponding Go test case to validate the fix
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| func.go | Fixed bug where v.String() was used instead of val.String(), causing all stack strings to get the same value |
| testdata/abitest/abi_test.c | Added C function to test multiple strings passed on stack with 8 int32 parameters |
| func_test.go | Added test case that calls the new C function with 3 different strings to verify they maintain distinct values |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Match the project's C formatting conventions: - Single-line function signatures - 4-space indentation - Consistent pointer spacing Addresses review feedback about line formatting.
TotallyGamerJet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add test case that verifies multiple string arguments passed on the stack each receive their correct distinct values, rather than all receiving the same duplicated value. This test catches the bug fixed in the previous commit where v.String() was incorrectly used instead of val.String(). Closes #356
Add test case that verifies multiple string arguments passed on the stack each receive their correct distinct values, rather than all receiving the same duplicated value. This test catches the bug fixed in the previous commit where v.String() was incorrectly used instead of val.String(). Closes ebitengine#356
What issue is this addressing?
#356
What type of issue is this addressing?
bug
What this PR does | solves
Fixes improper use of outer loop variable when handling strings.
Additionally, adds a tool to generate various stack tests.