cmd/compile: fix blank label code

When checkEnabled is forced true, the 52278 test fails. Be a bit
more careful about processing blank labels.

Update #52278

Change-Id: I48aa89e2c9e3715d8efe599bc4363b5b5879d8a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/419318
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Keith Randall 2022-07-24 09:48:56 -07:00 committed by Keith Randall
parent 9fcc8b2c1e
commit 24dc27a3c0
2 changed files with 5 additions and 1 deletions

View file

@ -1496,6 +1496,10 @@ func (s *state) stmt(n ir.Node) {
case ir.OLABEL: case ir.OLABEL:
n := n.(*ir.LabelStmt) n := n.(*ir.LabelStmt)
sym := n.Label sym := n.Label
if sym.IsBlank() {
// Nothing to do because the label isn't targetable. See issue 52278.
break
}
lab := s.label(sym) lab := s.label(sym)
// The label might already have a target block via a goto. // The label might already have a target block via a goto.

View file

@ -1,4 +1,4 @@
// compile // compile -d=ssa/check/on
// Copyright 2022 The Go Authors. All rights reserved. // Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style