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: cannot slice 2³²-element array on amd64 #7397
Labels
Milestone
Comments
http://play.golang.org/p/U5-fzNJD0Z The problem comes from gc/walk.c // static checks if possible bv = 1LL<<50; if(isconst(bound, CTINT)) { if(!smallintconst(bound)) yyerror("array len too large"); else bv = mpgetfix(bound->val.u.xval); } smallintconst asserts that the constant can be expressed as a x86_64 immediate constant which is only 31 bits wide (32 bits maybe, certainly not larger). Labels changed: added release-go1.3maybe, repo-main, arch-x86-64. Status changed to Accepted. |
This doesn't seem important enough to fix now. Note that it only occurs for the fixed-length array. If you use make I believe everything is fine. This works on my 64-bit system: package main import "fmt" func main() { // does not work in playground r := make([]struct{}, 0x80000000) rr := r[:1] fmt.Println(rr) } Labels changed: added release-go1.4, removed release-go1.3. |
rsc
changed the title
cmd/6g: cannot slice 2^32-element array
cmd/compile: cannot slice 2³²-element array on amd64
Jun 8, 2015
Looks like this can be closed. The following:
now works (tested on |
@ALTree, thanks. Closing. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by john.souvestre:
The text was updated successfully, but these errors were encountered: