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) Vector128/256.WithElement throws ArgumentOutOfRangeException before evaluating its value argument #134196
The JIT expansion of WithElement emits the index range check ahead of the value argument, so when the index is out of range the value expression's side effects are dropped entirely — violating C# left-to-right argument evaluation.
Correct output with DOTNET_EnableHWIntrinsic=0 (managed fallback). Also repros on released .NET 10.0.12.
Not float- or width-specific: Vector256<float> and Vector128<int> behave the same, and a null receiver in the value argument (v.WithElement(idx, h.F)) yields ArgumentOutOfRangeException instead of NullReferenceException. Compiler::gtNewSimdWithElementNode (gentree.cpp) calls addRangeCheckForHWIntrinsic on op2, rewriting the index into COMMA(BOUNDS_CHECK, index), without first spilling op3 to a temp; the check is above the per-target #if, so all targets should be affected.
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)