Skip to content

Conversation

@janvorli
Copy link
Member

@janvorli janvorli commented Dec 9, 2025

The current interpreter logic handles the
System.Double/Single.ConvertToIntegerNative always as must expand and fails with NO_WAY if the integer type is not primitive. However, that makes it incorrectly fail e.g. when the integer type is Int128.

This change fixes it by using the compiled version of the function for non-primitive types.
It fixes the following libraries tests:

  • System.Tests.DoubleTests_GenericMath.ConvertToIntegerNativeTest
  • System.Tests.SingleTests_GenericMath.ConvertToIntegerNativeTest

The current logic handles the
System.Double/Single.ConvertToIntegerNative always as must expand and
fails with NO_WAY if the integer type is not primitive. However, that
makes it incorrectly fail e.g. when the integer type is Int128.

This change fixes it by using the compiled version of the function for
non-primitive types.
@janvorli janvorli added this to the 11.0.0 milestone Dec 9, 2025
@janvorli janvorli self-assigned this Dec 9, 2025
@janvorli janvorli requested review from BrzVlad and kg as code owners December 9, 2025 13:21
Copilot AI review requested due to automatic review settings December 9, 2025 13:21
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a 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 in the interpreter where System.Double/Single.ConvertToIntegerNative incorrectly fails for non-primitive integer types like Int128. The fix allows these conversions to fall back to the compiled method implementation instead of attempting to expand the intrinsic inline.

Key Changes:

  • Modified the intrinsic expansion logic to return false for non-primitive target types instead of jumping to a failure handler
  • Added explanatory comment documenting why non-primitive types use the compiled method path

@janvorli janvorli merged commit 3458dfc into dotnet:main Dec 10, 2025
106 checks passed
@janvorli janvorli deleted the fix-converttointegernative-intrinsic-expansion branch December 10, 2025 23:13
@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants