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: internal compiler error: panic: unexpected type: 10 with GOEXPERIMENT=unified #52124

Closed
ALTree opened this issue Apr 3, 2022 · 1 comment
Labels
NeedsFix
Milestone

Comments

@ALTree
Copy link
Member

@ALTree ALTree commented Apr 3, 2022

$ gotip version
go version devel go1.19-73a81d84b6 Sun Apr 3 07:18:10 2022 +0000 linux/amd64
package p

type I interface{ any | int }
$ GOEXPERIMENT=unified gotip tool compile crash.go 
<unknown line number>: internal compiler error: panic: unexpected type: 10

goroutine 1 [running]:
runtime/debug.Stack()
	/home/alberto/gotip/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x410000?, 0xc0?}, {0xd084e3, 0x9}, {0xc00008d028, 0x1, 0x1})
	/home/alberto/gotip/src/cmd/compile/internal/base/print.go:227 +0x1d7
cmd/compile/internal/base.Fatalf(...)
	/home/alberto/gotip/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/gc.handlePanic()
	/home/alberto/gotip/src/cmd/compile/internal/gc/main.go:48 +0x85
panic({0xc77460, 0xc00005c020})
	/home/alberto/gotip/src/runtime/panic.go:838 +0x212
cmd/compile/internal/noder.(*reader).doTyp(0xc000412c60)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:414 +0x2bd
cmd/compile/internal/noder.(*pkgReader).typIdx(0xc0003f2240, {0xc00008d2f0?, 0xb2?}, 0xc000000000, 0x1)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:349 +0x17b
cmd/compile/internal/noder.(*reader).typWrapped(0xc000412b00, 0x0?)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:321 +0x45
cmd/compile/internal/noder.(*reader).typ(...)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:315
cmd/compile/internal/noder.(*reader).interfaceType(0xc000412b00)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:466 +0x216
cmd/compile/internal/noder.(*reader).doTyp(0xc000412b00)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:444 +0x249
cmd/compile/internal/noder.(*pkgReader).typIdx(0xc0003f2240, {0xc00008d520?, 0xff?}, 0xc000000000, 0x0)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:349 +0x17b
cmd/compile/internal/noder.(*reader).typWrapped(0xc0004126e0, 0x0?)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:321 +0x45
cmd/compile/internal/noder.(*pkgReader).objIdx(0xc0003f2240, 0x6?, {0x0, 0x0, 0x0}, {0x13a13e0, 0x0, 0x0})
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:664 +0x5d6
cmd/compile/internal/noder.(*reader).obj(0xc0004122c0)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:563 +0x1ee
cmd/compile/internal/noder.(*reader).pkgObjs(0xc0004122c0, 0xc0001486c0)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:1913 +0xb2
cmd/compile/internal/noder.(*reader).pkgDecls(0xc0004122c0, 0xc0001486c0)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:1902 +0x1d4
cmd/compile/internal/noder.(*reader).pkgInit(0xc0004122c0, 0xc000410020?, 0xc0001486c0)
	/home/alberto/gotip/src/cmd/compile/internal/noder/reader.go:1841 +0xdf
cmd/compile/internal/noder.unified({0xc000012440?, 0x0?, 0x2?})
	/home/alberto/gotip/src/cmd/compile/internal/noder/unified.go:107 +0x319
cmd/compile/internal/noder.LoadPackage({0xc000022070, 0x1, 0x0?})
	/home/alberto/gotip/src/cmd/compile/internal/noder/noder.go:73 +0x2c5
cmd/compile/internal/gc.Main(0xd37dd8)
	/home/alberto/gotip/src/cmd/compile/internal/gc/main.go:190 +0xb13
main.main()
	/home/alberto/gotip/src/cmd/compile/main.go:55 +0xdd

Doesn't crash without GOEXPERIMENT=unified.

cc @mdempsky @cuonglm

@ALTree ALTree added the NeedsInvestigation label Apr 3, 2022
@ALTree ALTree added this to the Go1.19 milestone Apr 3, 2022
@cuonglm cuonglm added NeedsFix and removed NeedsInvestigation labels Apr 4, 2022
@gopherbot
Copy link

@gopherbot gopherbot commented Apr 4, 2022

Change https://go.dev/cl/397874 mentions this issue: cmd/compile: support reading union type for compiler backend in unified IR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix
Projects
None yet
Development

No branches or pull requests

3 participants