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) XOR-based rotation recognition produces a wrong result when the shift count is a multiple of the operand width #133864
fgOperIsBitwiseRotationRoot accepts GT_XOR as a rotation root, but OR and XOR are only interchangeable when
the two shifted values have disjoint bits. With a variable count that is a multiple of the operand width both
sub-shifts equal x, so the XOR must be 0 while ROL(x, 0) is x.
fgRecognizeAndMorphBitwiseRotation (morph.cpp) has no nonzero-count requirement for the GT_XOR root.
The GT_OR root is fine — (x << 0) | (x >>> N) yields x, matching ROL(x, 0).
Only the GT_XOR root with a variable rotate amount is affected; constant counts of 0 are already rejected
earlier by the overmask check.
Possible fix: only allow a GT_XOR root when the rotate amount is provably not a multiple of the operand width.
Also reproduces on .NET 10.0.12.
Activity
dotnet-policy-service commentedon Sep 14, 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:
JIT: reject variable-count XOR rotation recognition (#133867)