diff options
Diffstat (limited to 'src/cmd/gc/inl.c')
-rw-r--r-- | src/cmd/gc/inl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cmd/gc/inl.c b/src/cmd/gc/inl.c index cf89b0090..45e15bb9b 100644 --- a/src/cmd/gc/inl.c +++ b/src/cmd/gc/inl.c @@ -804,9 +804,12 @@ inlvar(Node *var) n->curfn = curfn; // the calling function, not the called one n->addrtaken = var->addrtaken; - // esc pass wont run if we're inlining into a iface wrapper - // luckily, we can steal the results from the target func - if(var->esc == EscHeap) + // Esc pass wont run if we're inlining into a iface wrapper. + // Luckily, we can steal the results from the target func. + // If inlining a function defined in another package after + // escape analysis is done, treat all local vars as escaping. + // See issue 9537. + if(var->esc == EscHeap || (inl_nonlocal && var->op == ONAME)) addrescapes(n); curfn->dcl = list(curfn->dcl, n); |