Issues exists in current master (go1.18-devel), but has probably existed for a while.
When an OAS node is converted to an OSELRECV2 node in tcSelect(), any DCL node in the Init field (due to a := assignment) is being dropped, since a completely new node is being created and the Init field was not set.
Thanks for the test case created by @mdempsky:
package main
func main() {
ch := make(chan int, 1)
var ptrs [2]*int
for i := range ptrs {
ch <- i
select {
case x := <-ch:
ptrs[i] = &x
}
}
for i, ptr := range ptrs {
if *ptr != i {
println("FAIL:", *ptr, "!=", i)
}
}
}
Issues exists in current master (go1.18-devel), but has probably existed for a while.
When an OAS node is converted to an OSELRECV2 node in tcSelect(), any DCL node in the Init field (due to a := assignment) is being dropped, since a completely new node is being created and the Init field was not set.
Thanks for the test case created by @mdempsky: