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: ICE compiling code with anonymous, recursive interfaces #56056

Open
mdempsky opened this issue Oct 5, 2022 · 0 comments
Open

cmd/compile: ICE compiling code with anonymous, recursive interfaces #56056

mdempsky opened this issue Oct 5, 2022 · 0 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mdempsky
Copy link
Member

mdempsky commented Oct 5, 2022

$ cat z.go
package main

func main() {
	type I interface{ m() interface{ I } }
	type J interface{ m() interface{ J } }

	im := interface{ I }.m
	jm := interface{ J }.m

	_ = &im == &jm
}

$ go run z.go |& head -24
# command-line-arguments
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc0207f6370 stack=[0xc0207f6000, 0xc0407f6000]
fatal error: stack overflow

runtime stack:
runtime.throw({0xd83c2f?, 0x133c740?})
	/home/mdempsky/wd/go/src/runtime/panic.go:1047 +0x5d fp=0xc000691e18 sp=0xc000691de8 pc=0x43645d
runtime.newstack()
	/home/mdempsky/wd/go/src/runtime/stack.go:1103 +0x5bd fp=0xc000691fc8 sp=0xc000691e18 pc=0x45031d
runtime.morestack()
	/home/mdempsky/wd/go/src/runtime/asm_amd64.s:570 +0x8b fp=0xc000691fd0 sp=0xc000691fc8 pc=0x46830b

goroutine 7 [running]:
cmd/compile/internal/types.(*Sym).cmpsym(0x0?, 0x0?)
	/home/mdempsky/wd/go/src/cmd/compile/internal/types/type.go:1132 +0x1ae fp=0xc0207f6380 sp=0xc0207f6378 pc=0x5ad06e
cmd/compile/internal/types.(*Type).cmp(0xc000158690, 0xc000411570)
	/home/mdempsky/wd/go/src/cmd/compile/internal/types/type.go:1207 +0x212 fp=0xc0207f64f8 sp=0xc0207f6380 pc=0x5ad292
cmd/compile/internal/types.(*Type).cmp(0xc000158620, 0xc000411500)
	/home/mdempsky/wd/go/src/cmd/compile/internal/types/type.go:1327 +0xa9c fp=0xc0207f6670 sp=0xc0207f64f8 pc=0x5adb1c
cmd/compile/internal/types.(*Type).cmp(0xc000158690, 0xc000411570)
	/home/mdempsky/wd/go/src/cmd/compile/internal/types/type.go:1347 +0xdc5 fp=0xc0207f67e8 sp=0xc0207f6670 pc=0x5ade45
cmd/compile/internal/types.(*Type).cmp(0xc000158620, 0xc000411500)
	/home/mdempsky/wd/go/src/cmd/compile/internal/types/type.go:1327 +0xa9c fp=0xc0207f6960 sp=0xc0207f67e8 pc=0x5adb1c

It looks like somewhere we're trying to sort types, but types.(*Type).cmp doesn't handle anonymous, recursive interfaces.

/cc @golang/compiler

@mdempsky mdempsky added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 5, 2022
@mdempsky mdempsky added this to the Unplanned milestone Oct 5, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants