You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: walkConvInterface produces broken IR #56768
$ go version
go version devel go1.20-b1678e508b Wed Nov 16 04:04:52 2022 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
What did you do?
Compile following program:
package p
type I interface {
M()
}
type S struct{}
func (*S) M() {}
type slice []any
func f() {
ss := struct {
i I
}{
i: &S{},
}
_ = [...]struct {
s slice
}{
{
s: slice{ss.i},
},
{
s: slice{ss.i},
},
{
s: slice{ss.i},
},
{
s: slice{ss.i},
},
{
s: slice{ss.i},
},
}
}
What did you expect to see?
Compile ok.
What did you see instead?
/home/cuonglm/p.go:30:15: cannot use <node ITAB> (type *uintptr) as type *uint8 in assignment
/home/cuonglm/p.go:33:15: cannot use <node ITAB> (type *uintptr) as type *uint8 in assignment
/home/cuonglm/p.go:36:15: cannot use <node ITAB> (type *uintptr) as type *uint8 in assignment
/home/cuonglm/p.go:39:15: cannot use <node ITAB> (type *uintptr) as type *uint8 in assignment
/home/cuonglm/p.go:42:15: cannot use <node ITAB> (type *uintptr) as type *uint8 in assignment
The fix for #56727 reveals this bug, because it called typecheck on walked IR.
The problem is in walkConvInterface, we generate code like:
var typeWord *uint8
typeWord = itab
But itab has type *uintptr. I think we can just switch itab to *uint8 (any generic pointer type should work, I guess) cc @randall77
Activity
gopherbot commentedon Nov 16, 2022
Change https://go.dev/cl/451256 mentions this issue:
cmd/compile: fix broken IR for iface -> efacecuonglm commentedon Nov 16, 2022
@gopherbot please backport this to go1.19
gopherbot commentedon Nov 16, 2022
Backport issue(s) opened: #56770 (for 1.19).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.
cmd/compile: fix broken IR for iface -> eface