Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: avoid unnecessary calls to runtime.panicIndex #37740
What version of Go are you using?
go version go1.14 windows/amd64
What did you do?
What did you expect to see?
The generated machine code contains zero calls to
As a bonus, the code generator should recognize that the pattern
What did you see instead?
Damn, I didn't think of that. On a 32-bit platform an overflow is entirely possible. On a 64-bit platform with enough virtual memory, you would only need 67 million bars of 256 GB RAM each, which is expensive but not impossible.
My rescue argument to this is: In this particular case, the size of each slice entry takes 2 machine words (it's a