Skip to content

cmd/go2go: segfault in go2go playground #39693

Closed
@davidthomas426

Description

@davidthomas426

What version of Go are you using (go version)?

go2go playground

What did you do?

https://go2goplay.golang.org/p/EOl5XMwthzt

Even more pared down: https://go2goplay.golang.org/p/gGupo3meUf7

Just trying out generics for the first time. Used a type list in an interface, but I got the syntax wrong.

What did you expect to see?

Syntax error, like in this link: https://go2goplay.golang.org/p/e54jIQntO97

type checking failed for main
prog.go2:4:2: int is not an interface
prog.go2:4:7: float64 is not an interface

Go build failed.

What did you see instead?

Seg fault and panic

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x56ca7a]

goroutine 1 [running]:
go/types.(*Checker).handleBailout(0xc00007c6c0, 0xc0000c9be0)
	/usr/local/go-faketime/src/go/types/check.go:251 +0x98
panic(0x64d840, 0x8048d0)
	/usr/local/go-faketime/src/runtime/panic.go:969 +0x175
go/types.(*Interface).Complete(0x0, 0x0)
	/usr/local/go-faketime/src/go/types/type.go:608 +0x3a
go/types.(*Interface).Complete(0xc000084700, 0xc000084700)
	/usr/local/go-faketime/src/go/types/type.go:637 +0x265
go/types.(*TypeParam).Bound(0xc000072740, 0xc000072740)
	/usr/local/go-faketime/src/go/types/type.go:819 +0x47
go/types.optype(0x6de060, 0xc000072740, 0x0, 0x0)
	/usr/local/go-faketime/src/go/types/type.go:831 +0x4e
go/types.(*TypeParam).Interface(0xc000072740, 0x6daa60)
	/usr/local/go-faketime/src/go/types/type.go:848 +0x37
go/types.(*Checker).varType(0xc00007c6c0, 0x6daa60, 0xc00000c320, 0xc0000c9460, 0x56d1ff)
	/usr/local/go-faketime/src/go/types/typexpr.go:131 +0x6d
go/types.(*Checker).collectParams(0xc00007c6c0, 0xc0000f3220, 0xc000010ba0, 0x0, 0x0, 0xc00000e201, 0x0, 0x0, 0x0, 0x6dda00)
	/usr/local/go-faketime/src/go/types/typexpr.go:691 +0x4c9
go/types.(*Checker).funcType(0xc00007c6c0, 0xc0000f4840, 0x0, 0xc00000c460)
	/usr/local/go-faketime/src/go/types/typexpr.go:326 +0x8c7
go/types.(*Checker).funcDecl(0xc00007c6c0, 0xc0000f30e0, 0xc0000f4780)
	/usr/local/go-faketime/src/go/types/decl.go:779 +0xc5
go/types.(*Checker).objDecl(0xc00007c6c0, 0x6de7e0, 0xc0000f30e0, 0x0)
	/usr/local/go-faketime/src/go/types/decl.go:200 +0xb85
go/types.(*Checker).packageObjects(0xc00007c6c0)
	/usr/local/go-faketime/src/go/types/resolver.go:644 +0x3a9
go/types.(*Checker).checkFiles(0xc00007c6c0, 0xc00003dcb8, 0x1, 0x1, 0x0, 0x0)
	/usr/local/go-faketime/src/go/types/check.go:280 +0x118
go/types.(*Checker).Files(...)
	/usr/local/go-faketime/src/go/types/check.go:256
go/types.(*Config).Check(0xc0000725c0, 0xc00001a3e0, 0x4, 0xc000072240, 0xc00003dcb8, 0x1, 0x1, 0xc000055360, 0x0, 0x4b6d2f, ...)
	/usr/local/go-faketime/src/go/types/api.go:387 +0x188
go/go2go.RewriteBuffer(0xc0000553b0, 0x7ffebe9a2dd8, 0x1e, 0xc0000b8000, 0xad, 0x2ad, 0x0, 0xc000010a50, 0xc000010a20, 0xc0000109f0, ...)
	/usr/local/go-faketime/src/go/go2go/go2go.go:127 +0x24f
main.translateFile(0xc0000553b0, 0x7ffebe9a2dd8, 0x1e)
	/usr/local/go-faketime/src/cmd/go2go/translate.go:26 +0xa9
main.main()
	/usr/local/go-faketime/src/cmd/go2go/main.go:64 +0x2ea

Go build failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions