Skip to content

cmd/compile: internal compiler error: name too long #27256

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

Closed
elagergren-spideroak opened this issue Aug 27, 2018 · 11 comments
Closed

cmd/compile: internal compiler error: name too long #27256

elagergren-spideroak opened this issue Aug 27, 2018 · 11 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@elagergren-spideroak
Copy link

elagergren-spideroak commented Aug 27, 2018

Please answer these questions before submitting your issue. Thanks!

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

1.11, darwin/amd64

What did you do?

https://play.golang.org/p/WNDetHOIGt3

$ cat x.go
package tmp

type Q interface {
	Foo()
	Bar()
	Baz()
}

type B interface {
	B() Q
}

type O interface {
	O() interface {
		O
		B
		Q
	}
}

type W interface {
	W() interface {
		O
		B
		Q
	}
}

type S interface {
	S() interface {
		S
		W
		Q
	}
}
# _/tmp
<autogenerated>:1: internal compiler error: name too long: *interface { Bar(); Baz(); Foo(); S() interface { Bar(); Baz(); Foo(); S() interface { Bar(); Baz(); 
[ ... ]
Baz(); Foo(); O() interface { B() tmp.Q; Bar(); Baz(); Foo(); O() interface { B() tmp.Q; Bar(); Baz(); Foo(); O() interface { B<...>; Bar<...>; Baz<...>; Foo<...>; O<...> } } } } } } } } 
[ ... ]

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new

If you remove S, it compiles just fine.

Related, if only tangentially, to #26863.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 27, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Aug 27, 2018
@elagergren-spideroak
Copy link
Author

elagergren-spideroak commented Aug 27, 2018

Doesn't seem to be a regression from 1.10.3 or 1.9.7.

@josharian
Copy link
Contributor

@griesemer @mdempsky

@griesemer
Copy link
Contributor

A typical case of infinite interface expansion when creating the type name during object file generation. Not related to exports. Related to #26863 only insofar that in both cases an recursive algorithm stack-overflows (but the code is completely unrelated).

@griesemer
Copy link
Contributor

@mdempsky Added you only in case you feel so inclined.

@griesemer
Copy link
Contributor

Too late for 1.12.

@griesemer griesemer modified the milestones: Go1.12, Go1.13 Dec 5, 2018
@elagergren-spideroak
Copy link
Author

elagergren-spideroak commented Feb 26, 2019

FWIW, the original (proprietary) code that triggered this problem can't be reproduced on 1.11.5, but the code in the playground link can.

$ go1.11.5 test -failfast -v ./...
$ go test -failfast -v ./... # 1.12
# [redacted]
<autogenerated>:1: internal compiler error: name too long:

@yagotome
Copy link

Is there any update on this issue? I'm facing the same error for large nested struct types definition on go version go1.14.2 linux/amd64.

@mdempsky
Copy link
Contributor

No updates other than what's been commented here. Anonymous, cyclic interfaces continue to be troublesome.

@randall77
Copy link
Contributor

randall77 commented Apr 29, 2020

This might have been fixed with CL 214239.
I believe that CL made it into 1.14. 1.14 fixes the OP's example for me.

@mdempsky
Copy link
Contributor

@randall77 Thanks, I missed that CL.

@griesemer
Copy link
Contributor

This appears to be working fine with Go 1.18 (adjusted test). Closing.

@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

9 participants