]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix CheckSize() calculation for -G=3 and stencils
authorDan Scales <danscales@google.com>
Tue, 24 Aug 2021 22:34:52 +0000 (15:34 -0700)
committerDan Scales <danscales@google.com>
Wed, 25 Aug 2021 15:30:19 +0000 (15:30 +0000)
commit099b819085e12ca45ac184cab5afb82538bec472
treeb580d10b26a2e3060acc4c5572756e036022f92a
parente1fcf8857e1b3e076cc3a6fad1860afe0d6c2ca6
cmd/compile: fix CheckSize() calculation for -G=3 and stencils

Because the Align/Width of pointer types are always set when created,
CalcSize() never descends past a pointer. Therefore, we need to do
CheckSize() at every level when creating type. We need to do this for
types creates by types2-to-types1 conversion and also by type
substitution (mostly for stenciling). We also need to do
Defer/ResumeCheckSize() at the top level in each of these cases to deal
with potentially recursive types.

These changes fix issue #47929 and also allow us to remove the
special-case CheckSize() call that causes the problem for issue #47901.

Fixes #47901
Fixes #47929

Change-Id: Icd8192431c145009cd6df2f4ade6db7da0f4dd3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/344829
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/noder/types.go
src/cmd/compile/internal/typecheck/subr.go
test/typeparam/issue47901.go [new file with mode: 0644]
test/typeparam/issue47929.go [new file with mode: 0644]