Open
Description
The same unnecessary bounds check previously reported for string (issue #115793, fixed in PR #115980) is also present for Span
and ReadOnlySpan
Repro: Godbolt
static bool Is(ReadOnlySpan<char> prefix, ReadOnlySpan<char> path)
{
if ((uint)prefix.Length < (uint)path.Length)
return (path[prefix.Length] == '/');
return false;
}
trunk-20250528+ab3d27fd24:
push rbp
mov rbp, rsp
cmp esi, ecx
jl SHORT G_M18054_IG05
xor eax, eax
pop rbp
ret
G_M18054_IG05: ;; offset=0x000C
cmp esi, ecx
jae SHORT G_M18054_IG07
mov eax, esi
cmp word ptr [rdx+2*rax], 47
sete al
movzx rax, al
pop rbp
ret
G_M18054_IG07: ;; offset=0x001F
call CORINFO_HELP_RNGCHKFAIL
int3
coreclr 9.0.2+80aa709f5d:
cmp esi, ecx
jb SHORT G_M18054_IG05
xor eax, eax
ret
G_M18054_IG05: ;; offset=0x0007
mov eax, esi
cmp word ptr [rdx+2*rax], 47
sete al
movzx rax, al
ret