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

Comments

Projects
None yet
6 participants
@dmitshur
Copy link
Member

commented Jun 27, 2017

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

commented Jun 27, 2017

@bradfitz bradfitz added the NeedsFix 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

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2017

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

@mdempsky

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

commented Jun 27, 2017

@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

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2017

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

Thank you for minimizing test case!

@gopherbot

This comment has been minimized.

Copy link

commented Jun 27, 2017

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

@gopherbot gopherbot closed this in c920fa5 Jun 28, 2017

@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.
You can’t perform that action at this time.