The following valid program compiled until Go 1.17beta1:
package main
var a, b, c interface{} = func() (_, _, _ int) { return 1, 2, 3 }()
func main() {
println(a.(int), b.(int), c.(int))
}
CL 327651 introduced the use of temporaries for return values of an OAS2FUNC. Consequently, when implicitly converted to an interface, these temporaries end up wrapped in an OCONVIFACE node.
Static initialization in cmd/compile/internal/staticinit/sched.go only expects OCONVNOP wrappings, resulting in an internal compiler error in Go 1.26.1:
./main.go:3:5: internal compiler error: unexpected rhs, not an autotmp:
. CONVIFACE Implicit INTER-interface {} tc(1) # main.go:3:5
. . NAME-main..autotmp_0 esc(N) Class:PAUTO Offset:0 AutoTemp OnStack Used int tc(1) # main.go:3:5
The bug has existed since Go 1.17rc1, where the error message originally was: internal compiler error: unexpected package-level statement: a, b, c = .autotmp_0, .autotmp_1, .autotmp_2.
The following valid program compiled until Go 1.17beta1:
CL 327651 introduced the use of temporaries for return values of an OAS2FUNC. Consequently, when implicitly converted to an interface, these temporaries end up wrapped in an OCONVIFACE node.
Static initialization in
cmd/compile/internal/staticinit/sched.goonly expects OCONVNOP wrappings, resulting in an internal compiler error in Go 1.26.1:The bug has existed since Go 1.17rc1, where the error message originally was:
internal compiler error: unexpected package-level statement: a, b, c = .autotmp_0, .autotmp_1, .autotmp_2.