compiler: containing small bfunction mixup in Gogo::write_globals
Fix buglet in Gogo::write_globals-- in a couple of places the
wrong Bfunction was being used for the containing (not target)
function when creating calls for init functions.
Change-Id: I45176d593b7672b4bf4a5e96730c0b90bf2e980e
Reviewed-on: https://go-review.googlesource.com/45510
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/go/gogo.cc b/go/gogo.cc
index 9071bc8..a9d72ff 100644
--- a/go/gogo.cc
+++ b/go/gogo.cc
@@ -1504,10 +1504,10 @@
Bfunction* initfn = func->get_or_make_decl(this, *p);
Bexpression* func_code =
this->backend()->function_code_expression(initfn, func_loc);
- Bexpression* call = this->backend()->call_expression(initfn, func_code,
+ Bexpression* call = this->backend()->call_expression(init_bfn, func_code,
empty_args,
NULL, func_loc);
- Bstatement* ist = this->backend()->expression_statement(initfn, call);
+ Bstatement* ist = this->backend()->expression_statement(init_bfn, call);
init_stmts.push_back(ist);
}