github.com/xushiwei/go@v0.0.0-20130601165731-2b9d83f45bc9/test/fixedbugs/bug119.go (about) 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 7 package main 8 9 func foo(a []int) int { 10 return a[0] // this seems to do the wrong thing 11 } 12 13 func 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 /* 25 uetli:~/Source/go1/test/bugs gri$ 6go bug119 26 3 70160 27 28 panic on line 83 PC=0x14d6 29 0x14d6?zi 30 mainĀ·main(23659, 0, 1, ...) 31 mainĀ·main(0x5c6b, 0x1, 0x7fff5fbff830, ...) 32 0x52bb?zi 33 mainstart(1, 0, 1606416432, ...) 34 mainstart(0x1, 0x7fff5fbff830, 0x0, ...) 35 uetli:~/Source/go1/test/bugs gri$ 36 */