Skip to content
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

cmd/compile: unneeded bounds checks #34816

Open
marigonzes opened this issue Oct 10, 2019 · 0 comments

Comments

@marigonzes
Copy link

commented Oct 10, 2019

What version of Go are you using (go version)?

$ go version
go version devel +2197321 Tue Oct 8 23:53:55 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What did you do?

I compiled the following functions to check if there were any bounds checks: https://godbolt.org/z/RSrNwR.

What did you expect to see?

I expected to see no bounds checks.

What did you see instead?

Instead, I see 7 different bounds checks generated by the Go compiler (highlighted in the site above).
I talked with @zdjones about this and it appears like all these bounds checks can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.