cmd/compile: unnecessary bounds check with slice offset #66691
Labels
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.22
Output of
go env
in your module/workspace:What did you do?
Compile the following:
What did you see happen?
I see the following in the assembly:
What did you expect to see?
No bounds check.
The bounds check is avoided if
offset
is 0, but fails once it is non-zero.However, this provably safe so long as
offset+8
does not overflow anint
.The text was updated successfully, but these errors were encountered: