mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/gc: handle variable initialization by block move in liveness
Any initialization of a variable by a block copy or block zeroing or by multiple assignments (componentwise copying or zeroing of a multiword variable) needs to emit a VARDEF. These cases were not. Fixes #7205. TBR=iant CC=golang-codereviews https://golang.org/cl/63650044
This commit is contained in:
parent
7addda685d
commit
91b1f7cb15
6 changed files with 65 additions and 12 deletions
18
test/live.go
18
test/live.go
|
|
@ -95,3 +95,21 @@ func f7() (x string) {
|
|||
return
|
||||
}
|
||||
|
||||
// ignoring block returns used to cause "live at entry to f8: x, y".
|
||||
|
||||
func f8() (x, y string) {
|
||||
return g8()
|
||||
}
|
||||
|
||||
func g8() (string, string)
|
||||
|
||||
// ignoring block assignments used to cause "live at entry to f9: x"
|
||||
// issue 7205
|
||||
|
||||
var i9 interface{}
|
||||
|
||||
func f9() bool {
|
||||
g8()
|
||||
x := i9
|
||||
return x != 99
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue