1// run
2
3// Copyright 2009 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
7package main
8
9type S struct {
10	a []int
11}
12
13var s = &S{make([]int, 10)}
14
15func main() {
16	s.a[f()] = 1 // 6g used to call f twice here
17}
18
19var n int
20
21func f() int {
22	if n++; n > 1 {
23		println("f twice")
24		panic("fail")
25	}
26	return 0
27}
28