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: "missing stack map index" for unreasonable type #20778

Open
josharian opened this Issue Jun 24, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@josharian
Contributor

josharian commented Jun 24, 2017

package p

type S struct {
	i interface {
		f() [1 << 27]S
	}
}

Compiling this results in a panic:

$ go tool compile x.go
<autogenerated>:1:0: internal compiler error: missing stack map index for v16 = CALLinter <mem> [2147483656] v12 v15

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/Users/josh/go/tip/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0x176870a, 0x1e, 0xc420332760, 0x1, 0x1)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/subr.go:181 +0x230
cmd/compile/internal/gc.(*SSAGenState).Call(0xc42031f140, 0xc420334700, 0xc4200ca7e8)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/ssa.go:4776 +0x364
cmd/compile/internal/amd64.ssaGenValue(0xc42031f140, 0xc420334700)
	/Users/josh/go/tip/src/cmd/compile/internal/amd64/ssa.go:757 +0x38db
cmd/compile/internal/gc.genssa(0xc420320140, 0xc420086690)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/ssa.go:4444 +0xbdb
cmd/compile/internal/gc.compileSSA(0xc420388000, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/pgen.go:242 +0x7e
cmd/compile/internal/gc.compile(0xc420388000)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/pgen.go:219 +0x218
cmd/compile/internal/gc.funccompile(0xc420388000)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/dcl.go:1049 +0xb7
cmd/compile/internal/gc.genwrapper(0xc4203158c0, 0xc4202f3240, 0xc42031e7e0, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/subr.go:1786 +0x73e
cmd/compile/internal/gc.imethods(0xc4203158c0, 0xc420322a10, 0x10102dc, 0xc42031a3c8)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/reflect.go:424 +0x318
cmd/compile/internal/gc.dtypesym(0xc4203158c0, 0xc4202ebae0)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/reflect.go:1189 +0x13d5
cmd/compile/internal/gc.dtypesym(0xc420315800, 0xc4202ebc80)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/reflect.go:1277 +0xe14
cmd/compile/internal/gc.dumpsignats()
	/Users/josh/go/tip/src/cmd/compile/internal/gc/reflect.go:1441 +0x3e7
cmd/compile/internal/gc.dumpobj1(0xc42001239c, 0x3, 0x3)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/obj.go:141 +0x2af
cmd/compile/internal/gc.dumpobj()
	/Users/josh/go/tip/src/cmd/compile/internal/gc/obj.go:51 +0x61
cmd/compile/internal/gc.Main(0x17756e8)
	/Users/josh/go/tip/src/cmd/compile/internal/gc/main.go:631 +0x24f7
main.main()
	/Users/josh/go/tip/src/cmd/compile/main.go:49 +0x89

1.8 panics too, albeit differently:

$ go tool compile x.go
<autogenerated>:1: stack frame too large (>2GB)
<unknown line number>: internal compiler error: NewFunc called without previous Free

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/Users/josh/go/1.8/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0x16c89ef, 0x24, 0x0, 0x0, 0x0)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/subr.go:167 +0x226
cmd/compile/internal/gc.(*ssaExport).Fatalf(0x19cdb95, 0xc400000000, 0x16c89ef, 0x24, 0x0, 0x0, 0x0)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/ssa.go:4984 +0x5d
cmd/compile/internal/ssa.(*Config).Fatalf(0xc42034a000, 0xc400000000, 0x16c89ef, 0x24, 0x0, 0x0, 0x0)
	/Users/josh/go/1.8/src/cmd/compile/internal/ssa/config.go:343 +0x6e
cmd/compile/internal/ssa.(*Config).NewFunc(0xc42034a000, 0x16d2570)
	/Users/josh/go/1.8/src/cmd/compile/internal/ssa/config.go:334 +0x16e
cmd/compile/internal/gc.buildssa(0xc420348e10, 0x0)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/ssa.go:65 +0x1ae
cmd/compile/internal/gc.compile(0xc420348e10)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/pgen.go:385 +0x204
cmd/compile/internal/gc.funccompile(0xc420348e10)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/dcl.go:1292 +0xdc
cmd/compile/internal/gc.genhash(0xc42039e3f0, 0xc42031f4a0)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/alg.go:319 +0x78e
cmd/compile/internal/gc.dalgsym(0xc42031f4a0, 0xffffffffffffffff)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/reflect.go:1546 +0x10da
cmd/compile/internal/gc.dcommontype(0xc42039e150, 0x0, 0xc42031f4a0, 0x0)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/reflect.go:834 +0xac
cmd/compile/internal/gc.dtypesym(0xc42031f4a0, 0xc420322860)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/reflect.go:1168 +0xb34
cmd/compile/internal/gc.dtypesym(0xc42031f5c0, 0xc42000c5f0)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/reflect.go:1199 +0x306
cmd/compile/internal/gc.dtypesym(0xc42031f2c0, 0xc420322600)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/reflect.go:1232 +0x114d
cmd/compile/internal/gc.dtypesym(0xc42031f200, 0x0)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/reflect.go:1318 +0xc79
cmd/compile/internal/gc.dumptypestructs()
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/reflect.go:1394 +0xd5
cmd/compile/internal/gc.dumpobj1(0xc420011455, 0x3, 0x3)
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/obj.go:134 +0x28b
cmd/compile/internal/gc.dumpobj()
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/obj.go:45 +0x52
cmd/compile/internal/gc.Main()
	/Users/josh/go/1.8/src/cmd/compile/internal/gc/main.go:492 +0x21c4
main.main()
	/Users/josh/go/1.8/src/cmd/compile/main.go:50 +0xfe

If the array bound is 1<<26, it takes forever to compile. If the array bound is plausible (like 1<<10), it compiles fine.

Marking as unplanned, pending actual code encountering this problem, which seems very unlikely.

Found with go-fuzz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment