-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: slice bounds out of range #62098
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
Comments
Are you able to provide more information on how this panic can be reproduced? |
I agree, but it's a large project with too much code to share. Here are some extra details. Let me know what other information I can provide. This is the build commands (not all of them) from right before the panic.
This is the call graph dumped (not the whole thing) from right before the panic.
go.mod:
|
That code is
To have such a slice out of bounds error, the symbol name would be something like The linker code could be more defensive on that. It would be good to see an example of such symbol, though. |
I've found something. The program builds if I comment this code
Though I am unable to reproduce the error in a sample program. |
Thanks. A simple reproducer is
We need to use plugin (or build as a plugin) to trigger the symbol name mangling. The offensive symbol is |
Might be related, we are seeing a similar issue: #62131 |
Change https://go.dev/cl/520856 mentions this issue: |
@gopherbot please backport this to Go 1.21. It is a regression in 1.21 causing valid programs fail to build. Thanks. |
Backport issue(s) opened: #62140 (for 1.21). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Change https://go.dev/cl/520857 mentions this issue: |
String symbol names could contain weird characters as we put the string literal into the symbol name. So it may appear to need mangling. However, as string symbols are grouped into a single "go:string.*" symbol, the individual symbol names actually don't matter. So don't mangle them. Also make the mangling code more defensive in case of weird symbol names. Updates #62098. Fixes #62140. Change-Id: I533012567a9fffab69debda934f426421c7abb04 Reviewed-on: https://go-review.googlesource.com/c/go/+/520856 Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> (cherry picked from commit b65e34f) Reviewed-on: https://go-review.googlesource.com/c/go/+/520857
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
The same thing happens with
go build .
.What did you expect to see?
My program running the same way it did on 1.20
What did you see instead?
I have confirmed that a simple hello world program does work so there must be something specific to the code or project environment.
I searched for the same issue and found #61060 but this seemed too different to lump in with that, and it's happening on the latest release.
The text was updated successfully, but these errors were encountered: