Home | History | Annotate | Download | only in fixedbugs
      1 // run
      2 
      3 // Copyright 2014 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 7944:
      8 // Liveness bitmaps said b was live at call to g,
      9 // but no one told the register optimizer.
     10 
     11 package main
     12 
     13 import "runtime"
     14 
     15 func f(b []byte) {
     16 	for len(b) > 0 {
     17 		n := len(b)
     18 		n = f1(n)
     19 		f2(b[n:])
     20 		b = b[n:]
     21 	}
     22 	g()
     23 }
     24 
     25 func f1(n int) int {
     26 	runtime.GC()
     27 	return n
     28 }
     29 
     30 func f2(b []byte) {
     31 	runtime.GC()
     32 }
     33 
     34 func g() {
     35 	runtime.GC()
     36 }
     37 
     38 func main() {
     39 	f(make([]byte, 100))
     40 }
     41