Skip to content

go/types, types2: cycle to ... panics for a variety of types #74928

@mrkfrmn

Description

@mrkfrmn

I was experimenting with a type declaration generator I wrote to help learn more about the Go type system. During this, I found a class of compiler crashes which could be related.

Here is one such program:

type t0 = *t2[t3]
type t1[p any] t0
type t2[p any] t3
type t3 = t0

Which causes:

cycle to *Alias
goroutine 1 [running]:
runtime/debug.Stack()
	/Users/markfreeman/dev/go/src/runtime/debug/stack.go:26 +0x64
main.try.func1()
	/Users/markfreeman/dev/grammar/main.go:55 +0x254
panic({0x1042dba60?, 0x140003ca020?})
	/Users/markfreeman/dev/go/src/runtime/panic.go:877 +0x128
go/types.(*Checker).handleBailout(0x140001ae3c0, 0x140000edc38)
	/Users/markfreeman/dev/go/src/go/types/check.go:467 +0x94
panic({0x1042dba60?, 0x140003ca020?})
	/Users/markfreeman/dev/go/src/runtime/panic.go:877 +0x128
go/types.(*typeWriter).error(...)
	/Users/markfreeman/dev/go/src/go/types/typestring.go:110

Similar programs cause crashes for:

  • cycle to *Array
  • cycle to *Named
  • cycle to *Pointer
  • cycle to *Signature
  • cycle to *Interface
  • cycle to *Struct

I suspect many of these share the same underlying cause. For brevity, those programs are not included.

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions