]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix width not calculated for imported type
authorCuong Manh Le <cuong@orijtech.com>
Mon, 8 Mar 2021 18:52:10 +0000 (01:52 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 8 Mar 2021 19:43:19 +0000 (19:43 +0000)
commitfee3cd4250843a0a7c056fed3d3e6e1a423f3120
tree116a9a1b3c75f62d7b6b6189fa3756a4e91490d6
parent7419a86c824efc6e2696f29e4dc1ac81756f1dfb
cmd/compile: fix width not calculated for imported type

The compiler currently has problem that some imported type is missing
size calculation. The problem is not triggered until CL 283313 merged,
due to the compiler can compile the functions immediately when it sees
them, so during SSA generation, size calculation is still ok.

CL 283313 makes the compiler always push functions to compile queue,
then drain from it for compiling function. During this process, the
types calculation size is disabled, so calculating size during SSA now
make the compiler crashes.

To fix this, we can just always calculate type size during typechecking,
when importing type from other packages.

Fixes #44732

Change-Id: I8d00ea0b5aadd432154908280e55d85c75f3ce92
Reviewed-on: https://go-review.googlesource.com/c/go/+/299689
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/typecheck/iimport.go
test/fixedbugs/issue44732.dir/bar/bar.go [new file with mode: 0644]
test/fixedbugs/issue44732.dir/foo/foo.go [new file with mode: 0644]
test/fixedbugs/issue44732.dir/main.go [new file with mode: 0644]
test/fixedbugs/issue44732.go [new file with mode: 0644]