modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue7083.go (about)

     1  // run
     2  
     3  package main
     4  
     5  import "runtime/debug"
     6  
     7  func f(m map[int]*string, i int) {
     8  	s := ""
     9  	m[i] = &s
    10  }
    11  
    12  func main() {
    13  	debug.SetGCPercent(0)
    14  	m := map[int]*string{}
    15  	for i := 0; i < 40; i++ {
    16  		f(m, i)
    17  		if len(*m[i]) != 0 {
    18  			println("bad length", i, m[i], len(*m[i]))
    19  			panic("bad length")
    20  		}
    21  	}
    22  }