mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
![Keith Randall](/assets/img/avatar_default.png)
Dead-code eliminating labels is tricky because there might be gotos that can still reach them. Bug probably introduced with CL 91056 Fixes #28616 Change-Id: I6680465134e3486dcb658896f5172606cc51b104 Reviewed-on: https://go-review.googlesource.com/c/147817 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Iskander Sharipov <iskander.sharipov@intel.com>
26 lines
325 B
Go
26 lines
325 B
Go
// compile
|
|
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Make sure we don't dead code eliminate a label.
|
|
|
|
package p
|
|
|
|
var i int
|
|
|
|
func f() {
|
|
|
|
if true {
|
|
|
|
if i == 1 {
|
|
goto label
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
label:
|
|
}
|