Skip to content

[clr-interp] Fix unbox.any for small integer types - #120016

Merged
davidwrighton merged 1 commit into
dotnet:mainfrom
davidwrighton:fix_unbox_any_for_small_integer_types
Sep 23, 2025
Merged

davidwrighton merged 1 commit into
dotnet:mainfrom
davidwrighton:fix_unbox_any_for_small_integer_types

Conversation

@davidwrighton

Copy link
Copy Markdown
Member
  • Since we unbox onto the evaluation stack directly, we need to ensure that the value we loaded is properly sign/zero extended to 4 bytes.

- Since we unbox onto the evaluation stack directly, we need to ensure that the value we loaded is properly sign/zero extended to 4 bytes.
Copilot AI review requested due to automatic review settings September 23, 2025 18:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 in the CLR interpreter's handling of unboxing small integer types (I1, U1, I2, U2) by ensuring proper sign/zero extension to 4 bytes when values are loaded onto the evaluation stack.

  • Adds conversion operations after unboxing for byte, sbyte, short, and ushort types
  • Ensures proper sign extension for signed types (I1, I2) and zero extension for unsigned types (U1, U2)
  • Maintains existing behavior for larger types that don't require conversion

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 23, 2025
@davidwrighton
davidwrighton merged commit 640fa69 into dotnet:main Sep 23, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants