From: Keith Randall Date: Sun, 24 Jul 2022 16:48:56 +0000 (-0700) Subject: cmd/compile: fix blank label code X-Git-Tag: go1.19~3^2~16 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=24dc27a3c0;p=gostls13.git 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 TryBot-Result: Gopher Robot Reviewed-by: Cherry Mui Reviewed-by: David Chase --- diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index a7778d37fb..2ee027092e 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 56169e6871..147b653037 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