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

Closed
josharian opened this issue Jun 24, 2017 · 3 comments
Closed

cmd/compile: "bad code" with very large return value #20780

josharian opened this issue Jun 24, 2017 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@josharian
Copy link
Contributor

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
@v47
Copy link

v47 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 The path to resolution is known, but the work has not been done. label Nov 29, 2017
@bradfitz
Copy link
Contributor

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
@gopherbot
Copy link

Change https://golang.org/cl/115195 mentions this issue: cmd/compile: include callee args section when checking frame too large

@golang golang locked and limited conversation to collaborators Jun 2, 2019
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

4 participants