Source file test/fixedbugs/issue20029.go
1 // run 2 3 // Copyright 2017 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 // Issue 20029: make sure we zero at VARKILLs of 8 // ambiguously live variables. 9 // The ambiguously live variable here is the hiter 10 // for the inner range loop. 11 12 package main 13 14 import "runtime" 15 16 func f(m map[int]int) { 17 outer: 18 for i := 0; i < 10; i++ { 19 for k := range m { 20 if k == 5 { 21 continue outer 22 } 23 } 24 runtime.GC() 25 break 26 } 27 runtime.GC() 28 } 29 func main() { 30 m := map[int]int{1: 2, 2: 3, 3: 4} 31 f(m) 32 } 33