diff options
| author | Dan Scales <danscales@google.com> | 2021-11-18 10:52:35 -0800 |
|---|---|---|
| committer | Dan Scales <danscales@google.com> | 2021-11-19 00:05:59 +0000 |
| commit | e8cda0a6c925668972ada40602ada08468fa90dc (patch) | |
| tree | a5aa331212a12003ef5740b787140fd7927dd3fc /src/cmd/compile/internal/noder/stencil.go | |
| parent | 2375b6edf376f97d0d8e3978fa3211788bc9b4dd (diff) | |
| download | go-e8cda0a6c925668972ada40602ada08468fa90dc.tar.xz | |
cmd/compile: don't run ComputeAddrTaken on imported generic functions
It causes a crash because of the unexpected XDOT operation. It's not
needed, since we will run ComputeAddrTaken() on function instantiations
after stenciling. And it's not always correct, since we may not be able
to distinguish between a array and a slice, if a type is dependent on a
type param.
However, we do need to call ComputeAddrTaken on instantiations created
during inlining, since that is after the main ComputeAddrTaken pass.
Fixes #49659
Change-Id: I0bb610cf11f14e4aa9068f6ca2a012337b069c79
Reviewed-on: https://go-review.googlesource.com/c/go/+/365214
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/noder/stencil.go')
| -rw-r--r-- | src/cmd/compile/internal/noder/stencil.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go index 174006ab5e..004db54c3b 100644 --- a/src/cmd/compile/internal/noder/stencil.go +++ b/src/cmd/compile/internal/noder/stencil.go @@ -109,6 +109,13 @@ func (g *genInst) buildInstantiations(preinliningMainScan bool) { // main round of inlining) for _, fun := range g.newInsts { inline.InlineCalls(fun.(*ir.Func)) + // New instantiations created during inlining should run + // ComputeAddrTaken directly, since we are past the main pass + // that did ComputeAddrTaken(). We could instead do this + // incrementally during stenciling (for all instantiations, + // including main ones before inlining), since we have the + // type information. + typecheck.ComputeAddrtaken(fun.(*ir.Func).Body) } } assert(l == len(g.newInsts)) |
