Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/cmd/compile/internal/ir/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"cmd/internal/src"
"encoding/base64"
"fmt"
"io"
"unicode/utf8"
)

Expand Down Expand Up @@ -472,9 +471,11 @@ func closureName(outerfn *Func, pos src.XPos, why Op, gen int) *types.Sym {
// we use a content hash to disambiguate instead.
// We choose the suffix as a hash of the inline call stack.
h := hash.New32()
io.WriteString(h, outer)
fmt.Fprint(h, inlIndex)
base.Ctxt.InlTree.AllParents(inlIndex, func(call obj.InlinedCall) {
io.WriteString(h, call.Name+":"+call.Pos.LineNumber()+":"+call.Pos.ColumnNumber())
if call.Parent >= 0 {
fmt.Fprint(h, " ", call.Parent)
}
})
inlHash = base64.StdEncoding.EncodeToString(h.Sum(nil)[:8])

Expand Down
6 changes: 5 additions & 1 deletion src/cmd/internal/obj/plist.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int, start src.XPos) {
return
}
if s.Func() != nil {
ctxt.Diag("%s: symbol %s redeclared\n\t%s: other declaration of symbol %s", ctxt.PosTable.Pos(start), s.Name, ctxt.PosTable.Pos(s.Func().Text.Pos), s.Name)
otherPos := src.NoPos
if s.Func().Text != nil {
otherPos = ctxt.PosTable.Pos(s.Func().Text.Pos)
}
ctxt.Diag("%s: symbol %s redeclared\n\t%s: other declaration of symbol %s", ctxt.PosTable.Pos(start), s.Name, otherPos, s.Name)
return
}
s.NewFuncInfo()
Expand Down
25 changes: 25 additions & 0 deletions test/fixedbugs/issue79274.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// compile

// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import "math/big"

func F() {
var pg0_0 *int
_ = pg0_0
var u16_0 uint16
fnc := func(a [0][][3]int, b [14][9]uint16, c []big.Int) uint16 {
pg0_0 = func() *int { return nil }()
return 0
}

fnc([0][][3]int{}, [14][9]uint16{[9]uint16{fnc([0][][3]int{}, [14][9]uint16{[9]uint16{min(fnc([0][][3]int{}, [14][9]uint16{[9]uint16{(uint16)(16), (uint16)(93), (uint16)(31)}, [9]uint16{(uint16)(5), (uint16)(69)}, [9]uint16{}}, []big.Int{}), u16_0), fnc([0][][3]int{}, [14][9]uint16{}, nil)}, [9]uint16{fnc([0][][3]int{}, [14][9]uint16{}, nil)}, [9]uint16{}}, nil), 0}}, nil)
}

func main() {
F()
}
6 changes: 6 additions & 0 deletions test/fixedbugs/issue79274a.dir/a.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package p
var _ = F(); func F() func() { return func() {} }
6 changes: 6 additions & 0 deletions test/fixedbugs/issue79274a.dir/b.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package p
var _ = F()
7 changes: 7 additions & 0 deletions test/fixedbugs/issue79274a.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// compiledir

// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package ignored
Loading