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: "bad code" with very large return value #20780

josharian opened this issue Jun 24, 2017 · 3 comments


None yet
4 participants
Copy link

commented Jun 24, 2017

package p

type S struct {
	i interface {
		f() [107374100]int

Compiling this with 1.9beta1 results in:

$ go tool compile x.go
compile: bad code

Same for 1.8.

Unlike its brethren, #20779 and #20778, the size of the return value here seems reasonable enough that it might be worth briefly investigating for 1.10, just in case.

Found by go-fuzz.

@josharian josharian added this to the Go1.10 milestone Jun 24, 2017


This comment has been minimized.

Copy link

commented Jul 10, 2017

Error is coming from here src/cmd/internal/obj/pcln.go
But in general, it's problem of offset, it's overflowing int32:

<autogenerated>:1:0: offset too large in 00022 (<autogenerated>:1)      MOVQ    BP, -2147483656(SP)
<autogenerated>:1:0: offset too large in 00030 (<autogenerated>:1)      LEAQ    -2147483656(SP), BP
<autogenerated>:1:0: offset too large in 00096 (<autogenerated>:1)      MOVQ    DX, ""..autotmp_2-3221225472(SP)
<autogenerated>:1:0: offset too large in 00109 (<autogenerated>:1)      LEAQ    ""..autotmp_2-3221225464(SP), DI
<autogenerated>:1:0: offset too large in 00125 (<autogenerated>:1)      MOVQ    ""..autotmp_2-3221225472(SP), DX
<autogenerated>:1:0: offset too large in 00149 (<autogenerated>:1)      LEAQ    ""..autotmp_2-3221225464(SP), SI
<autogenerated>:1:0: offset too large in 00165 (<autogenerated>:1)      MOVQ    -2147483656(SP), BP

@bradfitz bradfitz added the NeedsFix label Nov 29, 2017


This comment has been minimized.

Copy link

commented Nov 29, 2017

More detail at Go tip, but still present:

bradfitz@gdev:~$ go version
go version devel +992ce90 Wed Nov 29 03:24:52 2017 +0000 linux/amd64
bradfitz@gdev:~$ go tool compile x.go
<autogenerated>:1:0: overflow in spadj: 0 + 1717985616 = 1717985616
compile: bad code

It's been this way for 2 releases, so might as well be 3, sorry.

/cc @mdempsky

@bradfitz bradfitz modified the milestones: Go1.10, Go1.11 Nov 29, 2017


This comment has been minimized.

Copy link

commented May 29, 2018

Change mentions this issue: cmd/compile: include callee args section when checking frame too large

@gopherbot gopherbot closed this in 06b3260 Jun 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.