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 9func foo(a []int) int { 10 return a[0] // this seems to do the wrong thing 11} 12 13func main() { 14 a := &[]int{12} 15 if x := (*a)[0]; x != 12 { 16 panic(2) 17 } 18 if x := foo(*a); x != 12 { 19 // fails (x is incorrect) 20 panic(3) 21 } 22} 23 24/* 25uetli:~/Source/go1/test/bugs gri$ 6go bug119 263 70160 27 28panic on line 83 PC=0x14d6 290x14d6?zi 30 main·main(23659, 0, 1, ...) 31 main·main(0x5c6b, 0x1, 0x7fff5fbff830, ...) 320x52bb?zi 33 mainstart(1, 0, 1606416432, ...) 34 mainstart(0x1, 0x7fff5fbff830, 0x0, ...) 35uetli:~/Source/go1/test/bugs gri$ 36*/ 37