aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-05-19 15:08:04 -0400
committerRuss Cox <rsc@golang.org>2014-05-19 15:08:04 -0400
commita663e0a0381c22d3b1ef58b411df5cfbf56c2930 (patch)
tree208567f673cb1901a2e3ac0fd1c5c9abdb9b1b4e
parentf0bdee171f2490b2f9638e46cc133644f01a2156 (diff)
downloadgo-a663e0a0381c22d3b1ef58b411df5cfbf56c2930.tar.xz
cmd/gc: fix <-<-expr
The temporary-introducing pass was not recursing into the argumnt of a receive operation. Fixes #8011. LGTM=r R=golang-codereviews, r CC=golang-codereviews, iant, khr https://golang.org/cl/91540043
-rw-r--r--src/cmd/gc/order.c1
-rw-r--r--test/fixedbugs/issue8011.go18
2 files changed, 19 insertions, 0 deletions
diff --git a/src/cmd/gc/order.c b/src/cmd/gc/order.c
index 1311c6e5e2..b9f2d35ce4 100644
--- a/src/cmd/gc/order.c
+++ b/src/cmd/gc/order.c
@@ -1053,6 +1053,7 @@ orderexpr(Node **np, Order *order)
break;
case ORECV:
+ orderexpr(&n->left, order);
n = ordercopyexpr(n, n->type, order, 1);
break;
}
diff --git a/test/fixedbugs/issue8011.go b/test/fixedbugs/issue8011.go
new file mode 100644
index 0000000000..b966174c05
--- /dev/null
+++ b/test/fixedbugs/issue8011.go
@@ -0,0 +1,18 @@
+// run
+
+// Copyright 2014 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 chan int, 1)
+ c1 := make(chan int, 1)
+ c1 <- 42
+ c <- c1
+ x := <-<-c
+ if x != 42 {
+ println("BUG:", x, "!= 42")
+ }
+}