1
0
mirror of https://github.com/golang/go synced 2024-10-05 20:21:21 -06:00

[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 <daniel.morsing@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Keith Randall 2015-07-12 11:52:09 -07:00
parent 4c521ac8f2
commit 7e4c06dad0

View 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 {