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) Emulated vector arithmetic right shift evaluates the shift count before the vector operand #134195
When >> on a vector has to be emulated, the JIT evaluates the shift-count operand before the vector operand, so the implicit exception checks of the two operands fire in the wrong order.
sbyte: NullReferenceException
int : NullReferenceException
Actual
sbyte: IndexOutOfRangeException
int : NullReferenceException
Notes
Repros on released .NET 10.0.12, and also under DOTNET_JITMinOpts=1, so it is not optimizer-dependent. sbyte is always emulated; Vector128<long>/Vector256<long> show the same reversal once AVX-512 is unavailable (DOTNET_EnableAVX512=0). short/int use a native psra* and are correct.
Only implicit checks reorder: side effects expressed as calls are spilled to temps in source order and stay correct. gtNewSimdBinOpNode GT_RSH (gentree.cpp) puts the fgMakeMultiUse definition of the non-constant shift count into maskOp, which becomes the first operand of the ConditionalSelect, while the vector operand stays second.
Activity
dotnet-policy-service commentedon Sep 18, 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: Preserve SIMD operand evaluation and ordering (dotnet#133776)