From a663e0a0381c22d3b1ef58b411df5cfbf56c2930 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 19 May 2014 15:08:04 -0400 Subject: [PATCH] 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 --- src/cmd/gc/order.c | 1 + test/fixedbugs/issue8011.go | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/fixedbugs/issue8011.go 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") + } +} -- 2.48.1