diff options
author | Russ Cox <rsc@golang.org> | 2010-02-01 23:05:15 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-02-01 23:05:15 -0800 |
commit | 6546057f38c6c3c395a516df36669b86add35c83 (patch) | |
tree | 2f53c14e0b635beace769b5df1ad38cfed9aaae5 /test | |
parent | a0737a07c2e95132c32f0ac6f32bb811bd23c537 (diff) | |
download | golang-6546057f38c6c3c395a516df36669b86add35c83.tar.gz |
gc: bug246
R=ken2
CC=golang-dev
http://codereview.appspot.com/198057
Diffstat (limited to 'test')
-rw-r--r-- | test/fixedbugs/bug246.go (renamed from test/bugs/bug246.go) | 12 | ||||
-rw-r--r-- | test/golden.out | 5 |
2 files changed, 8 insertions, 9 deletions
diff --git a/test/bugs/bug246.go b/test/fixedbugs/bug246.go index e46cdfd04..1c4dc0d53 100644 --- a/test/bugs/bug246.go +++ b/test/fixedbugs/bug246.go @@ -1,4 +1,4 @@ -// $G $D/$F.go || echo BUG: bug246 +// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug246 // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -10,9 +10,13 @@ import "unsafe" func main() { // works - addr := uintptr(0) - _ = (*int)(unsafe.Pointer(addr)) + addr := uintptr(0x234) + x1 := (*int)(unsafe.Pointer(addr)) // fails - _ = (*int)(unsafe.Pointer(uintptr(0))) + x2 := (*int)(unsafe.Pointer(uintptr(0x234))) + + if x1 != x2 { + panicln("mismatch", x1, x2) + } } diff --git a/test/golden.out b/test/golden.out index 63d179cba..cf2297e1a 100644 --- a/test/golden.out +++ b/test/golden.out @@ -150,8 +150,3 @@ throw: interface conversion panic PC=xxx == bugs/ - -=========== bugs/bug246.go -bugs/bug246.go:17: cannot convert 0 to type unsafe.Pointer -bugs/bug246.go:17: cannot convert 0 (type uintptr) to type *int in conversion -BUG: bug246 |