mirror of
https://github.com/golang/go
synced 2024-11-23 19:20:03 -07:00
334056a7bc
For historical reasons, temp was returning a copy of the created Node*, not the original Node*. This meant that if analysis recorded information in the returned node (for example, n->addrtaken = 1), the analysis would not show up on the original Node*, the one kept in fn->dcl and consulted during liveness bitmap creation. Correct this, and watch for it when setting addrtaken. Fixes #7083. R=khr, dave, minux.ma CC=golang-codereviews https://golang.org/cl/51010045
23 lines
303 B
Go
23 lines
303 B
Go
// run
|
|
|
|
package main
|
|
|
|
import "runtime/debug"
|
|
|
|
func f(m map[int]*string, i int) {
|
|
s := ""
|
|
m[i] = &s
|
|
}
|
|
|
|
func main() {
|
|
debug.SetGCPercent(0)
|
|
m := map[int]*string{}
|
|
for i := 0; i < 40; i++ {
|
|
f(m, i)
|
|
if len(*m[i]) != 0 {
|
|
println("bad length", i, m[i], len(*m[i]))
|
|
panic("bad length")
|
|
}
|
|
}
|
|
}
|