]> Cypherpunks repositories - gostls13.git/commit
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>
Thu, 17 Nov 2022 19:55:28 +0000 (19:55 +0000)
commit81c9b1d65f3e416e134a30484c4bd6563aa825b5
treea305294008bce4ad1ab2327e7be9c15cfe586e1d
parent0bd4710ca61463716d1f88d33cc4f6e92b9b8255
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 #56768

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>
src/cmd/compile/internal/walk/convert.go
test/fixedbugs/issue56768.go [new file with mode: 0644]