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) Strength reduction produces wrong values: AddRecMayOverflow treats a non-constant add-recurrence start as zero #133759
34359738344,34359738352,34359738360,0,8,16,24,32,40,48 (the int counter wraps through zero, so (uint)c restarts at 0). Reproduced with DOTNET_JitEnableStrengthReduction=0.
Actual
34359738344,34359738352,34359738360,34359738368,34359738376,34359738384,34359738392,34359738400,34359738408,34359738416 — the sequence keeps climbing past 2^32*8, exit code 101.
Notes
scev.cpp:1738-1742 in AddRecMayOverflow returns "cannot overflow" whenever Start->GetConstantValue() fails, i.e. treats any symbolic start as 0, contradicting the comment at scev.cpp:1731 ("only ... addRec = <L, 0, 1>"). Simplify (scev.cpp:1132-1136) then distributes the zext into <L, V02.2, 1> producing <L, zext(V02.2), 1>, and strength reduction materializes it as a new 64-bit primary IV. Correct shape would be the step guard's form: if (!GetConstantValue(...) || (startCns != 0)) return true;.
@jakobbotsch would you consider backporting the fix from #133766 to release/11.0?
It currently only exists in main (12.0). The repro still fails on the shipped 11.0 RC2 SDK (11.0.100-rc.2.26467.112), while 8.0.425, 9.0.318 and 10.0.401 all behave correctly, so this is a regression introduced during the 11.0 cycle rather than a long-standing bug — 11.0 would ship with it.
Note: this comment was produced by an AI agent; the repro was re-run against all four released SDKs to confirm the results above.
The regression here is that 304e5a8 makes us recognize some more IR for SCEV analysis and then the issue can be triggered. But the issue exists back to 9.0 with other shapes, e.g.
I don't think this deserves a backport, I think it is very unlikely the user will have a provably overflowing arithmetic operation like this in combination with the cast required.
Activity
dotnet-policy-service commentedon Sep 11, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
EgorBo commentedon Sep 18, 2026
Affected SDK versions:
EgorBo commentedon Sep 18, 2026
@jakobbotsch would you consider backporting the fix from #133766 to
release/11.0?It currently only exists in
main(12.0). The repro still fails on the shipped 11.0 RC2 SDK (11.0.100-rc.2.26467.112), while 8.0.425, 9.0.318 and 10.0.401 all behave correctly, so this is a regression introduced during the 11.0 cycle rather than a long-standing bug — 11.0 would ship with it.Note: this comment was produced by an AI agent; the repro was re-run against all four released SDKs to confirm the results above.
jakobbotsch commentedon Sep 22, 2026
The regression here is that 304e5a8 makes us recognize some more IR for SCEV analysis and then the issue can be triggered. But the issue exists back to 9.0 with other shapes, e.g.
reproduces it too in .NET 9.
I don't think this deserves a backport, I think it is very unlikely the user will have a provably overflowing arithmetic operation like this in combination with the cast required.