From 2aabacdb5aa4176f3c2916a096d8ac6934113562 Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Tue, 16 Jun 2015 17:58:03 -0700 Subject: [PATCH] [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 --- src/cmd/compile/internal/gc/ssa.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index 81a55e4065..f2dbabe6ad 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -335,6 +335,9 @@ func (s *state) stmt(n *Node) { 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 @@ func (s *state) expr(n *Node) *ssa.Value { 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: -- 2.48.1