]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.19] cmd/compile: fix broken IR for iface -> eface
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 16 Nov 2022 18:02:26 +0000 (01:02 +0700)
committerGopher Robot <gobot@golang.org>
Wed, 28 Dec 2022 16:11:17 +0000 (16:11 +0000)
commit5758a14e431c88996a8061435e8381a26af0a214
treeedb8890434a13a46d30a5d133e8d1a7c0048a3ad
parent91bc4cd118ddf6e43338dd5e2d53dcc995f9831a
[release-branch.go1.19] cmd/compile: fix broken IR for iface -> eface

For implementing interface to empty interface conversion, the compiler
generate code like:

var res *uint8
res = itab
if res != nil {
res = res.type
}

However, itab has type *uintptr, so the assignment is broken. The
problem is not shown up, until CL 450215, which call typecheck on this
broken assignment.

To fix this, just cast itab to *uint8 when doing the conversion.

Fixes #56770

Change-Id: Id42792d18e7f382578b40854d46eecd49673792c
Reviewed-on: https://go-review.googlesource.com/c/go/+/451256
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/451875
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
src/cmd/compile/internal/walk/convert.go
test/fixedbugs/issue56768.go [new file with mode: 0644]