]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: don't run ComputeAddrTaken on imported generic functions
authorDan Scales <danscales@google.com>
Thu, 18 Nov 2021 18:52:35 +0000 (10:52 -0800)
committerDan Scales <danscales@google.com>
Fri, 19 Nov 2021 00:05:59 +0000 (00:05 +0000)
commite8cda0a6c925668972ada40602ada08468fa90dc
treea5aa331212a12003ef5740b787140fd7927dd3fc
parent2375b6edf376f97d0d8e3978fa3211788bc9b4dd
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>
src/cmd/compile/internal/ir/node.go
src/cmd/compile/internal/noder/stencil.go
src/cmd/compile/internal/typecheck/func.go
test/typeparam/issue49659.dir/a.go [new file with mode: 0644]
test/typeparam/issue49659.dir/b.go [new file with mode: 0644]
test/typeparam/issue49659.go [new file with mode: 0644]
test/typeparam/issue49659b.go [new file with mode: 0644]