You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: (bug) Loop stepped by checked(i - (-1)) is unrolled to one iteration, dropping an OverflowException #133583
i starts at 2147483646. The first iteration leaves i == int.MaxValue; the second evaluates checked(int.MaxValue - (-1)), which overflows and throws. DOTNET_JITMinOpts=1 prints exactly
this.
Actual
returned 1
The optimizer decides the loop runs exactly once, so the second (throwing) update is deleted
entirely and Test returns normally. The unrolled iteration count is wrong for a != loop whose
step is a checked subtraction of a negative constant.
Platform
Windows x64, .NET 11 (dotnet/runtime main @ a0b86b1, Checked build). Requires DOTNET_TieredCompilation=0; no special CPU features.
Activity
dotnet-policy-service commentedon Sep 10, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
AndyAyersMS commentedon Sep 10, 2026
Not a new bug, fails the same way in .NET 7 through now.
JIT: fix checked subtraction loop unrolling (#133646)
EgorBo commentedon Sep 18, 2026
Affected SDK versions:
JIT: fix checked subtraction loop unrolling (dotnet#133646)