golang/go

cmd/compile: internal compiler error: Expand calls interface data problem

ALTree opened this issue · 4 comments

$ gotip version
go version devel go1.18-6fefb7f9f3 Fri Nov 5 07:00:05 2021 +0000 windows/amd64
package p

func f(i int) {
        var s1 struct {
                s struct{ s struct{ i int } }
        }
        var s2, s3 struct {
                a struct{ i int }
                b int
        }
        func() {
                i = 1 + 2*i + s3.a.i + func() int {
                        s2.a, s2.b = s3.a, s3.b
                        return 0
                }() + func(*int) int {
                        return s1.s.s.i
                }(new(int))
        }()
}
$ gotip tool compile crash.go

crash.go:18:2: internal compiler error: 'f.func1': Expand calls interface data problem, func f.func1, v=v39 = StructSelect <int> [0] v13, w=v13 = StructSelect <int> [0] v9


goroutine 1 [running]:
runtime/debug.Stack()
        D:/users/XXX/alberto/other/gotip/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x1145140?, 0x0?}, {0xc0000be7c0, 0x3f}, {0xc000059300, 0x4, 0x4})
        D:/users/XXX/alberto/other/gotip/src/cmd/compile/internal/base/print.go:227 +0x1ca
cmd/compile/internal/base.Fatalf(...)
        D:/users/XXX/alberto/other/gotip/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0x8?, {0x171f0598?, 0x208?}, {0x11ee34e, 0x39}, {0xc0003c23f0, 0x3, 0x0?})
        D:/users/XXX/alberto/other/gotip/src/cmd/compile/internal/ssagen/ssa.go:7650 +0x17d
cmd/compile/internal/ssa.(*Func).Fatalf(0xc0003de380, {0x11ee34e, 0x39}, {0xc0003c23f0, 0x3, 0x3})
        D:/users/XX/alberto/other/gotip/src/cmd/compile/internal/ssa/func.go:773 +0x279
cmd/compile/internal/ssa.expandCalls(0xc0003de380)
        D:/users/XXX/alberto/other/gotip/src/cmd/compile/internal/ssa/expand_calls.go:1472 +0xbff
cmd/compile/internal/ssa.Compile(0xc0003de380)

Compiles fine on go1.17.2.

Similar: #49249.

@dr2chase sounds like what you worried in CL 360057 is right.

Change https://golang.org/cl/361594 mentions this issue: cmd/compile: restore source type after recursive call storeArgOrLoad

@gopherbot please open backport to 1.16 and 1.17

cc @randall77 @dr2chase

Backport issue(s) opened: #49391 (for 1.16), #49392 (for 1.17).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.