Fix bug in RangeOps::ShiftRight#123794
Merged
EgorBo merged 3 commits intodotnet:mainfrom Jan 30, 2026
Merged
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib |
EgorBo
commented
Jan 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an incorrect range computation in JIT range analysis for right-shift operations (RangeOps::ShiftRight), addressing #123790 and adding a regression test to prevent recurrence.
Changes:
- Add a JIT regression test for the reported shift/comparison miscompile.
- Rework
RangeOps::ShiftRightto compute bounds using opposite shift-count endpoints (lower usesr2.UpperLimit, upper usesr2.LowerLimit) when the shift-count range is constant and within[0..31]. - Remove
Range::IsSingleConstValueusage in favor of the existingRange::IsSingleValueConstant.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/tests/JIT/Regression/JitBlue/Runtime_123790/Runtime_123790.cs | Adds an xUnit regression test for the miscompile scenario from #123790. |
| src/coreclr/jit/rangecheck.h | Updates range computation logic for ShiftRight and replaces IsSingleConstValue references with IsSingleValueConstant. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
Author
|
/azp run Fuzzlyn |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
PTAL @jakobbotsch @dotnet/jit-contrib fix for ShiftRight (see description). No diffs. |
jakobbotsch
approved these changes
Jan 30, 2026
Member
Author
|
/ba-g deadletter |
This was referenced Jan 30, 2026
Open
Member
Author
|
/ba-g deadletter |
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.
Fixes #123790
For e.g.
[0..65535] >> [0..31]I didn't realize I need to swap lower and upper bound for r2, so the result should be:[0 >> 31 .. 65535 >> 0], not[0 >> 0 .. 65535 >> 31]No diffs