]> Cypherpunks repositories - gostls13.git/commit
cmd/gc: fix order of channel evaluation of receive channels
authorRuss Cox <rsc@golang.org>
Mon, 25 Aug 2014 11:05:45 +0000 (07:05 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 25 Aug 2014 11:05:45 +0000 (07:05 -0400)
commit20e97677fd61dbdca128e9628e28327988c39bb4
tree0a367536845a57ceed4b7a1e19c3a3edcab0fd40
parentf595f834be92ee726ddfb0bea223243ebba32eac
cmd/gc: fix order of channel evaluation of receive channels

Normally, an expression of the form x.f or *y can be reordered
with function calls and communications.

Select is stricter than normal: each channel expression is evaluated
in source order. If you have case <-x.f and case <-foo(), then if the
evaluation of x.f causes a panic, foo must not have been called.
(This is in contrast to an expression like x.f + foo().)

Enforce this stricter ordering.

Fixes #8336.

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews, r
https://golang.org/cl/126570043
src/cmd/gc/order.c
test/fixedbugs/issue8336.go [new file with mode: 0644]