-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: No BCE for str[len(str):] #53409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you explain? Replacing |
Oh, I literally meant
|
Ah, ok, I see what you're saying. Looks like the BCE is defeated by converting from a We don't do |
🤦 go/src/cmd/compile/internal/walk/range.go Lines 19 to 33 in ef808ae
go/src/cmd/compile/internal/walk/range.go Lines 114 to 137 in ef808ae
|
Change https://go.dev/cl/414876 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
I expected the bounds check on
for range s[i+1:]
to be eliminated, since0 < i+1 <= len(s)
, ands[len(s):]
is always valid.It works as expected for
[]byte
instead of[]string
.What did you see instead?
The text was updated successfully, but these errors were encountered: