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 doesn't elide bounds checking when iterating over a span and an array of known length #110986
If you ensure that the length of an array and a span are the same, the JIT will still emit bounds checking on only the span when indexing.
This does not occur when iterating over a span and a span, or an array and an array.
Activity
dotnet-policy-service commentedon Dec 29, 2024
Tagging subscribers to this area: @dotnet/area-system-memory
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Dec 29, 2024
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
EgorBo commentedon Dec 29, 2024
It works if both are arrays. Presumably it should work here as well once #82946 is implemented.
tannergooding commentedon Dec 31, 2024
Notably as well it does work if you insert a
span1 = span1.Slice(span2.Length)after aif (span1.Length != span2.Length) { return; }check.So there is a relatively easy workaround, but ideally we'd still just handle correlating the array/span or span/span lengths directly.