Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1737)

Side by Side Diff: test/fixedbugs/issue4313.go

Issue 6997047: code review 6997047: cmd/gc: fix eval order in select (Closed)
Patch Set: diff -r 99a549ecc846 https://code.google.com/p/go/ Created 11 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/gc/subr.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // run
2
3 // Copyright 2012 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Order of operations in select.
8
9 package main
10
11 func main() {
12 c := make(chan int, 1)
13 x := 0
14 select {
15 case c <- x: // should see x = 0, not x = 42 (after makec)
16 case <-makec(&x): // should be evaluated only after c and x on previous line
17 }
18 y := <-c
19 if y != 0 {
20 panic(y)
21 }
22 }
23
24 func makec(px *int) chan bool {
25 if false { for {} }
26 *px = 42
27 return make(chan bool, 0)
28 }
OLDNEW
« no previous file with comments | « src/cmd/gc/subr.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b