We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
package p func f() { var b [0]struct{} _ = b[2:] }
gotype says:
x.go:5:8: index 2 (constant of type int) is out of bounds
cmd/compile gives no error. If you change b's type to [1]struct{}, the error from cmd/compile is:
[1]struct{}
x.go:5: invalid slice index 2 (out of bounds for 1-element array)
Reproduces with (at least) 1.7 and 1.8 and 1.9beta1.
The text was updated successfully, but these errors were encountered:
Found with go-fuzz.
Sorry, something went wrong.
gccgo says
foo8.go:5:8: error: array index out of bounds _ = b[2:] ^
This is clearly a cmp/compile bug. Interestingly, the compiler complains for an index expression (b[2]) rather than a slice expression (b[2:]).
b[2]
b[2:]
Trivial fix. Moving to 1.9.
CL https://golang.org/cl/46466 mentions this issue.
47e659b
No branches or pull requests
gotype says:
cmd/compile gives no error. If you change b's type to
[1]struct{}
, the error from cmd/compile is:Reproduces with (at least) 1.7 and 1.8 and 1.9beta1.
The text was updated successfully, but these errors were encountered: