From: Cuong Manh Le Date: Sun, 3 Nov 2024 08:52:29 +0000 (+0700) Subject: cmd/compile: fix inlining name mangling for blank label X-Git-Tag: go1.24rc1~494 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=324f41b748fd87ad4a1cafa458bac3014f2fb5f2;p=gostls13.git cmd/compile: fix inlining name mangling for blank label Fixes #70175 Change-Id: I13767d951455854b03ad6707ff9292cfe9097ee9 Reviewed-on: https://go-review.googlesource.com/c/go/+/624377 LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Reviewed-by: Keith Randall Auto-Submit: Cuong Manh Le Reviewed-by: Keith Randall Auto-Submit: Keith Randall --- diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go index 39ac1400a0..eca66487fa 100644 --- a/src/cmd/compile/internal/noder/reader.go +++ b/src/cmd/compile/internal/noder/reader.go @@ -2068,7 +2068,7 @@ func (r *reader) switchStmt(label *types.Sym) ir.Node { func (r *reader) label() *types.Sym { r.Sync(pkgbits.SyncLabel) name := r.String() - if r.inlCall != nil { + if r.inlCall != nil && name != "_" { name = fmt.Sprintf("~%s·%d", name, inlgen) } return typecheck.Lookup(name) diff --git a/test/fixedbugs/issue70175.go b/test/fixedbugs/issue70175.go new file mode 100644 index 0000000000..0ad6e39a7f --- /dev/null +++ b/test/fixedbugs/issue70175.go @@ -0,0 +1,17 @@ +// compile + +// Copyright 2024 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 + +func f() { +_: + +_: +} + +func main() { + f() +}