You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
here's another angle to this bug perhaps? The crash seems to also happen when two different files contain the same tiny function call at the same line and column. That suggests the compiler is accidentally treating them as the same generated function because it uses line/column information but not the filename.
@cuonglm here's a fix that seems to work! (add more context to the hash like the source file and inling tree index)
diff --git a/src/cmd/compile/internal/ir/func.go b/src/cmd/compile/internal/ir/func.go
index 7990310423..af05d50803 100644
--- a/src/cmd/compile/internal/ir/func.go
+++ b/src/cmd/compile/internal/ir/func.go
@@ -14,6 +14,7 @@ import (
"encoding/base64"
"fmt"
"io"
+ "strconv"
"unicode/utf8"
)
@@ -471,11 +472,17 @@ func closureName(outerfn *Func, pos src.XPos, why Op, gen int) *types.Sym {
// it will not be the linker symbol name. For linking,
// we use a content hash to disambiguate instead.
// We choose the suffix as a hash of the inline call stack.
+ // Include the source filename, since distinct files can have
+ // calls with the same function name, line, and column, and the
+ // inlining tree index, since it is the compiler's unique identity
+ // for this inlined call.
h := hash.New32()
io.WriteString(h, outer)
base.Ctxt.InlTree.AllParents(inlIndex, func(call obj.InlinedCall) {
- io.WriteString(h, call.Name+":"+call.Pos.LineNumber()+":"+call.Pos.ColumnNumber())
+ pos := base.Ctxt.InnermostPos(call.Pos)
+ io.WriteString(h, ":"+call.Name+":"+pos.Filename()+":"+pos.LineNumber()+":"+strconv.FormatUint(uint64(pos.Col()), 10))
})
+ h.Write([]byte(":" + strconv.Itoa(inlIndex)))
inlHash = base64.StdEncoding.EncodeToString(h.Sum(nil)[:8])
outer = base.Ctxt.InlTree.InlinedFuncName(inlIndex)
Activity
gabyhelp commentedon May 8, 2026
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
cuonglm commentedon May 8, 2026
git bisect points to 409f784
dims commentedon May 8, 2026
here's another angle to this bug perhaps? The crash seems to also happen when two different files contain the same tiny function call at the same line and column. That suggests the compiler is accidentally treating them as the same generated function because it uses line/column information but not the filename.
the output is:
Started looking at it as kubernetes has CI jobs that use golang tip and they are broken:
kubernetes/kubernetes#138891
dims commentedon May 8, 2026
@cuonglm here's a fix that seems to work! (add more context to the hash like the source file and inling tree index)
mark-rushakoff commentedon May 8, 2026
I believe I've run into the same panic when compiling https://github.com/gabriel-vasile/mimetype as a dependency of a different project.
go version go1.27-devel_afcf04cb64 Fri May 8 05:51:09 2026 -0700 darwin/arm64Permalink to the source line: https://github.com/gabriel-vasile/mimetype/blob/e64d6bdb3607578757d31380818651a9fc95ca8b/internal/magic/magic.go#L163
gopherbot commentedon May 8, 2026
Change https://go.dev/cl/775900 mentions this issue:
cmd/compile: fix duplicated inlining hash for closuresgopherbot commentedon May 8, 2026
Change https://go.dev/cl/775624 mentions this issue:
cmd/compile: use inline tree index to identify call stackcmd/compile: use inline tree index to identify call stack