-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
What version of Go are you using (go version)?
$ go version go version devel go1.18-088bb4b Tue Nov 2 06:25:39 2021 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
What did you do?
https://go.dev/play/p/eyem-XNTdye
https://go.godbolt.org/z/bMTGW9E7W
What did you expect to see?
Since i and size are always positive numbers,
i*size+1 is not equal to zero and will be always greater than i*size, so
data[i*size]check can be eliminated.
If i*size+1 overflows or i*size+1 >= len(data), data[i*size+1] will panic before accessing data[i*size].
What did you see instead?
Compiler emits two checks.
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Triage Backlog