diff options
author | Russ Cox <rsc@golang.org> | 2009-12-03 01:30:19 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-12-03 01:30:19 -0800 |
commit | 36ce4c427976ae699ee4171f0870894e11c38383 (patch) | |
tree | 4f703989e27b17cf352ddf2c0454540b3dff5c09 | |
parent | 78c64cbc52cebee45bc44ab09f172571514fc83f (diff) | |
download | golang-36ce4c427976ae699ee4171f0870894e11c38383.tar.gz |
gc: handle _ = <-c in select.
Fixes issue 238.
R=ken2
http://codereview.appspot.com/163098
-rw-r--r-- | src/cmd/gc/select.c | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug218.go (renamed from test/bugs/bug218.go) | 0 | ||||
-rw-r--r-- | test/fixedbugs/bug225.go | 22 | ||||
-rw-r--r-- | test/golden.out | 4 |
4 files changed, 23 insertions, 5 deletions
diff --git a/src/cmd/gc/select.c b/src/cmd/gc/select.c index 3f28b1c56..9cba01fa5 100644 --- a/src/cmd/gc/select.c +++ b/src/cmd/gc/select.c @@ -118,7 +118,7 @@ walkselect(Node *sel) else { // introduce temporary until we're sure this will succeed. tmp = nod(OXXX, N, N); - tempname(tmp, n->left->type); + tempname(tmp, n->right->type->type); a = nod(OADDR, tmp, N); } // selectrecv(sel *byte, hchan *chan any, elem *any) (selected bool); diff --git a/test/bugs/bug218.go b/test/fixedbugs/bug218.go index b2c9ede75..b2c9ede75 100644 --- a/test/bugs/bug218.go +++ b/test/fixedbugs/bug218.go diff --git a/test/fixedbugs/bug225.go b/test/fixedbugs/bug225.go new file mode 100644 index 000000000..8acf66c4e --- /dev/null +++ b/test/fixedbugs/bug225.go @@ -0,0 +1,22 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +func main() { + c := make(chan bool, 1); + select { + case _ = <-c: + panic("BUG: recv should not"); + default: + } + c <- true; + select { + case _ = <-c: + default: + panic("BUG: recv should"); + } +} diff --git a/test/golden.out b/test/golden.out index 64bfd6ecc..9813c8313 100644 --- a/test/golden.out +++ b/test/golden.out @@ -142,10 +142,6 @@ panic PC=xxx == bugs/ -=========== bugs/bug218.go -<epoch>: fatal error: dowidth: unknown type: blank -BUG: bug218 - =========== bugs/bug219.go bugs/bug219.go:16: syntax error near if BUG: bug219 |