cmd/compile: unnecessary bounds check when indexing slice from range #71439
Labels
BugReport
Issues describing a possible bug in the Go implementation.
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
Go version
go1.23
Output of
go env
in your module/workspace:What did you do?
Compile the following:
What did you see happen?
I see this compiled out:
What did you expect to see?
No such call to
runtime.panicIndex
. The slice is indexed from an iteration integer that is provably bounded by the length ofsrc
itself. The only possible way a panic occurs is ifsrc
is mutated during the iteration (or asynchronously in another goroutine, in which case there must be synchronization primitives).The text was updated successfully, but these errors were encountered: