Skip to content

Commit

Permalink
cmd/compile: fix blank label code
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: David Chase <[email protected]>
  • Loading branch information
randall77 committed Jul 25, 2022
1 parent 9fcc8b2 commit 24dc27a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/cmd/compile/internal/ssagen/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/fixedbugs/issue52278.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 24dc27a

Please sign in to comment.