]> Cypherpunks repositories - gostls13.git/commitdiff
gc: handle _ = <-c in select.
authorRuss Cox <rsc@golang.org>
Thu, 3 Dec 2009 09:30:19 +0000 (01:30 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 3 Dec 2009 09:30:19 +0000 (01:30 -0800)
Fixes #238.

R=ken2
https://golang.org/cl/163098

src/cmd/gc/select.c
test/fixedbugs/bug218.go [moved from test/bugs/bug218.go with 100% similarity]
test/fixedbugs/bug225.go [new file with mode: 0644]
test/golden.out

index 3f28b1c563dd559f8ff60477349ce1c3d2879b43..9cba01fa51e0ebfc6ebccf073a9dc578b7e75cf1 100644 (file)
@@ -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);
similarity index 100%
rename from test/bugs/bug218.go
rename to test/fixedbugs/bug218.go
diff --git a/test/fixedbugs/bug225.go b/test/fixedbugs/bug225.go
new file mode 100644 (file)
index 0000000..8acf66c
--- /dev/null
@@ -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");
+       }
+}
index 64bfd6ecc7b40bc4ae8deb7efa8ea29accd71dbb..9813c8313dcbc2b0ad022fc9499692e8bd77bc58 100644 (file)
@@ -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