aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-12-03 01:30:19 -0800
committerRuss Cox <rsc@golang.org>2009-12-03 01:30:19 -0800
commitc6e316a4b954cd2d6912cbfb0f5e00f0625862bd (patch)
treea245c9727d4c27c595765cef19bb40bf6c26aa41
parent05a1eb1ab0650b465b23f01ca0ea5944735fa63b (diff)
downloadgo-c6e316a4b954cd2d6912cbfb0f5e00f0625862bd.tar.gz
go-c6e316a4b954cd2d6912cbfb0f5e00f0625862bd.zip
gc: handle _ = <-c in select.
Fixes #238. R=ken2 https://golang.org/cl/163098
-rw-r--r--src/cmd/gc/select.c2
-rw-r--r--test/fixedbugs/bug218.go (renamed from test/bugs/bug218.go)0
-rw-r--r--test/fixedbugs/bug225.go22
-rw-r--r--test/golden.out4
4 files changed, 23 insertions, 5 deletions
diff --git a/src/cmd/gc/select.c b/src/cmd/gc/select.c
index 3f28b1c563..9cba01fa51 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 b2c9ede750..b2c9ede750 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 0000000000..8acf66c4e4
--- /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 64bfd6ecc7..9813c8313d 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