mirror of
https://github.com/golang/go
synced 2024-09-29 19:24:33 -06:00
cmd/vet/internal/cfg: don't crash on malformed goto statement
Change-Id: Ib285c02e240f02e9d5511bd448163ec1d4e75516 Reviewed-on: https://go-review.googlesource.com/24323 Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
f2c13d713d
commit
4764d6fd6e
@ -98,8 +98,10 @@ start:
|
||||
}
|
||||
|
||||
case token.GOTO:
|
||||
if s.Label != nil {
|
||||
block = b.labeledBlock(s.Label)._goto
|
||||
}
|
||||
}
|
||||
if block == nil {
|
||||
block = b.newBlock("undefined.branch")
|
||||
}
|
||||
|
@ -122,6 +122,12 @@ func f10(ch chan int) {
|
||||
}
|
||||
live()
|
||||
}
|
||||
|
||||
func f11() {
|
||||
goto; // mustn't crash
|
||||
dead()
|
||||
}
|
||||
|
||||
`
|
||||
|
||||
func TestDeadCode(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user