-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[clr-interp] Fix GitHub_9651 by allowing an I4 to be treated as a ByRef #122189
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
Conversation
davidwrighton
commented
Dec 4, 2025
- This is part of allowing I4 and I to be interchangeable, since some forms of ByRef will devolve to be treated as an I
- This isn't a fully general purpose fix, but in cases where it is valid code it will make it work.
- This is part of allowing I4 and I to be interchangeable, since some forms of ByRef will devolve to be treated as an I - This isn't a fully general purpose fix, but in cases where it is valid code it will make it work.
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
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 GitHub issue #9651 in the CoreCLR interpreter by allowing I4 (int32) values to be implicitly converted to ByRef types on 64-bit systems. The fix addresses a specific scenario where I4 and native int/ByRef can be used interchangeably in valid IL code, particularly when branching logic may assign either an int32 or an address to a native int variable.
Key Changes
- Modified the type conversion logic in the interpreter compiler to treat I4 to ByRef conversions similar to I4 to I8 (nint) conversions on 64-bit targets
- This allows IL code patterns where int32 zero and addresses are used interchangeably with native int variables
janvorli
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, thank you!