diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index a7778d37fb3..2ee027092e9 100644 --- a/src/cmd/compile/internal/ssagen/ssa.go +++ b/src/cmd/compile/internal/ssagen/ssa.go @@ -1496,6 +1496,10 @@ func (s *state) stmt(n ir.Node) { case ir.OLABEL: n := n.(*ir.LabelStmt) sym := n.Label + if sym.IsBlank() { + // Nothing to do because the label isn't targetable. See issue 52278. + break + } lab := s.label(sym) // The label might already have a target block via a goto. diff --git a/test/fixedbugs/issue52278.go b/test/fixedbugs/issue52278.go index 56169e68714..147b6530373 100644 --- a/test/fixedbugs/issue52278.go +++ b/test/fixedbugs/issue52278.go @@ -1,4 +1,4 @@ -// compile +// compile -d=ssa/check/on // Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style