igop
igop copied to clipboard
bug: ssa select case call expr order
$GOROOT/test/chan/select5
bug: golang.org/x/tools/go/ssa build order fp, fc
package main
var c = make(chan int, 1)
var nilch chan int
var n = 1
var x int
var i interface{}
var dummy = make(chan int)
var m = make(map[int]int)
var order = 0
// check order of operations by ensuring that
// successive calls to checkorder have increasing o values.
func checkorder(o int) {
if o <= order {
println("invalid order", o, "after", order)
panic("order")
}
order = o
}
func fc(c chan int, o int) chan int {
checkorder(o)
return c
}
func fp(p *int, o int) *int {
checkorder(o)
return p
}
func init() {
order = 0
c <- n
select {
case *fp(&x, 100) = <-fc(c, 1):
}
if x != n {
die(x)
}
n++
}
func die(x int) {
println("have", x, "want", n)
panic("chan")
}
func main() {
}
func init#1():
0: entry P:0 S:2
*order = 0:int
t0 = *c chan int
t1 = *n int
send t0 <- t1
t2 = fp(x, 100:int) *int
t3 = *c chan int
t4 = fc(t3, 1:int) chan int
t5 = <-t4 int
*t2 = t5
t6 = *x int
t7 = *n int
t8 = t6 != t7 bool
if t8 goto 1 else 2
1: if.then P:1 S:1
t9 = *x int
t10 = die(t9) ()
jump 2
2: if.done P:2 S:0
t11 = *n int
t12 = t11 + 1:int int
*n = t12
return