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: crashes when trying to export type C comparable #47966

Closed
griesemer opened this issue Aug 25, 2021 · 2 comments
Closed

cmd/compile: crashes when trying to export type C comparable #47966

griesemer opened this issue Aug 25, 2021 · 2 comments
Assignees
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Aug 25, 2021

Given

$ cat x.go
package main
type C comparable

we get a crash

$ go tool compile x.go
<autogenerated>:1: internal compiler error: missing pkg

goroutine 1 [running]:
runtime/debug.Stack()
	/Users/gri/goroot/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x3a1b28, 0xc0}, {0x18ef13b, 0xb}, {0x0, 0x0, 0x0})
	/Users/gri/goroot/src/cmd/compile/internal/base/print.go:227 +0x154
cmd/compile/internal/base.Fatalf(...)
	/Users/gri/goroot/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/typecheck.(*exportWriter).setPkg(0xc0003a1b20, 0x0, 0x1)
	/Users/gri/goroot/src/cmd/compile/internal/typecheck/iexport.go:1024 +0x55
cmd/compile/internal/typecheck.(*exportWriter).doTyp(0xc0003a1b20, 0xc000366d90)
	/Users/gri/goroot/src/cmd/compile/internal/typecheck/iexport.go:989 +0xb45
cmd/compile/internal/typecheck.(*iexporter).typOff(0xc00032c840, 0xc000366d90)
	/Users/gri/goroot/src/cmd/compile/internal/typecheck/iexport.go:864 +0x88
cmd/compile/internal/typecheck.(*exportWriter).typ(0xc0003a1ab0, 0xc000094654)
	/Users/gri/goroot/src/cmd/compile/internal/typecheck/iexport.go:711 +0x25
cmd/compile/internal/typecheck.(*iexporter).doDecl(0xc00032c840, 0xc0003c5110)
	/Users/gri/goroot/src/cmd/compile/internal/typecheck/iexport.go:569 +0x485
cmd/compile/internal/typecheck.WriteExports({0x1a48660, 0xc0003f02a0}, 0x1)
	/Users/gri/goroot/src/cmd/compile/internal/typecheck/iexport.go:301 +0x2eb
cmd/compile/internal/noder.WriteExports(0xc00008efa0)
	/Users/gri/goroot/src/cmd/compile/internal/noder/export.go:40 +0x7a
cmd/compile/internal/gc.dumpCompilerObj(0xc00008efa0)
	/Users/gri/goroot/src/cmd/compile/internal/gc/obj.go:107 +0x28
cmd/compile/internal/gc.dumpobj1({0xc0000c0df8, 0x3}, 0x3)
	/Users/gri/goroot/src/cmd/compile/internal/gc/obj.go:63 +0x185
cmd/compile/internal/gc.dumpobj()
	/Users/gri/goroot/src/cmd/compile/internal/gc/obj.go:44 +0x36
cmd/compile/internal/gc.Main(0x191b270)
	/Users/gri/goroot/src/cmd/compile/internal/gc/main.go:322 +0x10d6
main.main()
	/Users/gri/goroot/src/cmd/compile/main.go:55 +0xdd
@mdempsky
Copy link
Member

@mdempsky mdempsky commented Aug 25, 2021

Works with GOEXPERIMENT=unified.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 26, 2021

Change https://golang.org/cl/345174 mentions this issue: cmd/compile: support type C comparable

Loading

@gopherbot gopherbot closed this in d7a43e8 Aug 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants