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: unexpected "slice bounds out of range" panic on GOOS=nacl with inlining #20811

Closed
dmitshur opened this issue Jun 27, 2017 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dmitshur
Copy link
Contributor

The following program panics on the playground (and the playground only):

https://play.golang.org/p/XXdD7dPPc4

4398046511104
0
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
main.main()
	/tmp/sandbox960033620/main.go:13 +0x1c0

But it shouldn't. On a 32-bit environment, int(i) is 0, so v[n : n+3] should be an okay slice of length 3.

It does not panic for me locally with Go 1.8.3, nor 1.9beta2, when running with GOARCH=386.

It also doesn't panic if either of the two commented lines are uncommented. Feels related to inlining.

Is it a bug on the playground?

@mvdan
Copy link
Member

mvdan commented Jun 27, 2017

Perhaps related to GOOS=nacl? https://play.golang.org/p/czys1gPicX

@bradfitz bradfitz changed the title playground: unexpected "slice bounds out of range" panic cmd/compile: unexpected "slice bounds out of range" panic on GOOS=nacl with inlining Jun 27, 2017
@bradfitz
Copy link
Contributor

@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 27, 2017
@bradfitz bradfitz added this to the Go1.10 milestone Jun 27, 2017
@mdempsky mdempsky self-assigned this Jun 27, 2017
@cherrymui
Copy link
Member

I guess it is more due to GOARCH=amd64p32 than GOOS=nacl. I'll take a look.

@mdempsky
Copy link
Member

mdempsky commented Jun 27, 2017

Yeah, I think amd64p32 bug as well. Somewhat more minimized test case:

https://play.golang.org/p/7TrGkx7nM9

It looks like we're not correctly handing int64 => int conversions on amd64p32 in some cases.

Edit: Further minimized: https://play.golang.org/p/MkFBo5vIO2

@mdempsky
Copy link
Member

@cherrymui It looks like an SSA bug to me, so I'm happy to let you take it from here.

@mdempsky mdempsky assigned cherrymui and unassigned mdempsky Jun 27, 2017
@cherrymui
Copy link
Member

Yeah, it looks like an SSA bug. IsInBounds is lowered to CMPQ, which should be CMPL.

Thank you for minimizing test case!

@gopherbot
Copy link

CL https://golang.org/cl/46870 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants