]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: fix blank label code
authorKeith Randall <khr@golang.org>
Sun, 24 Jul 2022 16:48:56 +0000 (09:48 -0700)
committerKeith Randall <khr@google.com>
Mon, 25 Jul 2022 20:44:49 +0000 (20:44 +0000)
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>
src/cmd/compile/internal/ssagen/ssa.go
test/fixedbugs/issue52278.go

index a7778d37fb39200b00f297d8140dacb38b3b8322..2ee027092e9369ddc87342377379a011f49126a6 100644 (file)
@@ -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.
index 56169e687144f08c778da825451e930394334164..147b6530373922aeacc5a700bb42663589c284cc 100644 (file)
@@ -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