[dev.ssa] cmd/compile/internal/gc: support CALLFUNC as statement

I don't have strong understanding of the AST structure, so I'm
not sure if this is the right way to handle function call statements.

Change-Id: Ib526f667ab483b32d9fd17da800b5d6f4b26c4c9
Reviewed-on: https://go-review.googlesource.com/11139
Reviewed-by: Keith Randall <khr@golang.org>
diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go
index 81a55e4..f2dbabe 100644
--- a/src/cmd/compile/internal/gc/ssa.go
+++ b/src/cmd/compile/internal/gc/ssa.go
@@ -335,6 +335,9 @@
 
 		s.startBlock(bEnd)
 
+	case OCALLFUNC:
+		s.expr(n)
+
 	case OVARKILL:
 		// TODO(khr): ??? anything to do here?  Only for addrtaken variables?
 		// Maybe just link it in the store chain?
@@ -464,6 +467,10 @@
 		s.startBlock(bNext)
 		var titer Iter
 		fp := Structfirst(&titer, Getoutarg(n.Left.Type))
+		if fp == nil {
+			// CALLFUNC has no return value. Continue with the next statement.
+			return nil
+		}
 		a := s.entryNewValue1I(ssa.OpOffPtr, Ptrto(fp.Type), fp.Width, s.sp)
 		return s.newValue2(ssa.OpLoad, fp.Type, a, call)
 	default: