-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/link: panic: index out of range [23] with length 0 #49619
Comments
|
What's going on here is that the type in question (type.go.builtin.any) is one of those basic builtins that the compiler expects will be emitted when we compile the runtime, so it doesn't bother to emit it for every package. See ... meaning that it appears as unresolved at link time (we would get a similar failure mode if the compiler failed to emit an entry for "type.uintptr" when building the runtime, or some other core builtin type). Probably the easiest way to handle this would be force a reference to the type when building the runtime package, I'll send a CL. What is a bit puzzling about this one is why it hasn't come up before? Not sure about that. |
Wondering if this same thing could come up with other generics predefined types, maybe 'comparable'? I tried to construct a test case for that but ran into
|
Change https://golang.org/cl/364377 mentions this issue: |
This may be happening now because of @findleyr 's recent CL to try to preserve the 'any' type when converting from types2 to types1 (better error messages, etc.): https://go-review.googlesource.com/c/go/+/363974 |
I don't really understand the failure mode, but yes it seems highly likely that this is related to my CL. Before that change, I suspect we may never have produced types.AnyType. |
We can revert that CL, of course, but it would be nice if we could fix forward; preserving the identity of any is a nice usability improvement. |
@findleyr fix forward would be my choice. Compiler and linker already have a good deal of special cases for the runtime package when it comes to DWARF generation. |
@thanm sounds good, thanks! |
Change https://golang.org/cl/364614 mentions this issue: |
CL 364377 emitted definition of 'any' when compiling runtime. But 'any' is only available when generic enabled. Thus emitting its definition unconditionally causes the compiler crashes. Updates #49619 Change-Id: I0888ca1cbc7a7df300310a99a344f170636333f2 Reviewed-on: https://go-review.googlesource.com/c/go/+/364614 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
cc @randall77 @cherrymui
The text was updated successfully, but these errors were encountered: