Skip to content

Commit 7e4c06d

Browse files
committed
[dev.ssa] cmd/compile/internal/gc: handle _ label correctly
An empty label statement can just be ignored, as it cannot be the target of any gotos. Tests are already in test/fixedbugs/issue7538*.go Fixes #11589 Fixes #11593 Change-Id: Iadcd639e7200ce16aa40fd7fa3eaf82522513e82 Reviewed-on: https://go-review.googlesource.com/12093 Reviewed-by: Daniel Morsing <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 4c521ac commit 7e4c06d

File tree

1 file changed

+5
-0
lines changed
  • src/cmd/compile/internal/gc

1 file changed

+5
-0
lines changed

src/cmd/compile/internal/gc/ssa.go

+5
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ func (s *state) stmt(n *Node) {
316316
s.assign(OAS, n.Left.Name.Heapaddr, palloc)
317317

318318
case OLABEL, OGOTO:
319+
if n.Op == OLABEL && isblanksym(n.Left.Sym) {
320+
// Empty identifier is valid but useless.
321+
// See issues 11589, 11593.
322+
return
323+
}
319324
// get block at label, or make one
320325
t := s.labels[n.Left.Sym.Name]
321326
if t == nil {

0 commit comments

Comments
 (0)