go/pointer: fix two crashes caused by 'print()'.
+ Test.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/173540043
diff --git a/go/pointer/gen.go b/go/pointer/gen.go
index 12f4d79..48ca368 100644
--- a/go/pointer/gen.go
+++ b/go/pointer/gen.go
@@ -525,7 +525,9 @@
case "print":
// In the tests, the probe might be the sole reference
// to its arg, so make sure we create nodes for it.
- a.valueNode(call.Args[0])
+ if len(call.Args) > 0 {
+ a.valueNode(call.Args[0])
+ }
case "ssa:wrapnilchk":
a.copy(a.valueNode(instr.Value()), a.valueNode(call.Args[0]), 1)