Φ-node where initial value is nil causes segfault
In a Φ-node where the initial value is a typed constant, e.g. nil:[]int, Φ register will be stored as a "Panic:..." string (because we get the name of the initial register as reg.Name()) but does not terminate the program. Later when the Φ register is used, it causes a segfault.
The Φ-node always come after the initial register's assignment so a workround is to special-case when a Φ-node with nil initial value is present (e.g. store as a dummy register rather than trying to resolve the name). The type can be used to generate a zero value for the initial register.
MWE
package main
func main() {
var x []int
for i := 0; i < 3; i++ {
x = append(x, i)
}
}
This can be resolved by visiting the block from multiple edges into the block and assume the symbolic value to non-nil value.