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
11package main
12
13import "runtime"
14
15func 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
25func f1(n int) int {
26	runtime.GC()
27	return n
28}
29
30func f2(b []byte) {
31	runtime.GC()
32}
33
34func g() {
35	runtime.GC()
36}
37
38func main() {
39	f(make([]byte, 100))
40}
41