]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile/internal/gc: handle _ label correctly
authorKeith Randall <khr@golang.org>
Sun, 12 Jul 2015 18:52:09 +0000 (11:52 -0700)
committerKeith Randall <khr@golang.org>
Sun, 12 Jul 2015 20:43:01 +0000 (20:43 +0000)
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 <daniel.morsing@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/ssa.go

index 2eb0402f6943209e825a34f25f77efedfc12307d..d47680bf8ab610ef65f3d876c07f7abbf9922f2c 100644 (file)
@@ -316,6 +316,11 @@ func (s *state) stmt(n *Node) {
                s.assign(OAS, n.Left.Name.Heapaddr, palloc)
 
        case OLABEL, OGOTO:
+               if n.Op == OLABEL && isblanksym(n.Left.Sym) {
+                       // Empty identifier is valid but useless.
+                       // See issues 11589, 11593.
+                       return
+               }
                // get block at label, or make one
                t := s.labels[n.Left.Sym.Name]
                if t == nil {