Skip to content

cmd/compile: internal compiler error: found illegal assignment #48602

@ghost

Description

What version of Go are you using (go version)?

$ go version
go version devel go1.18-d413908320 Fri Sep 24 07:22:13 2021 +0000 windows/amd64

Does this issue reproduce with the latest release?

No

What operating system and processor architecture are you using (go env)?

  • windows/amd64
  • linux/amd64 (godbolt)

What did you do?

https://play.golang.org/p/91xOOjsmJjR

https://go.godbolt.org/z/Y9zjns7xK

What did you expect to see?

Successful compilation.

What did you see instead?

Stack trace
./example.go:18:2: internal compiler error: found illegal assignment main.Iterator[.shape.int_0] -> main.Iterator[main.R₄]; :
	Iterator[.shape.int_0] does not implement Iterator[main.R₄] (wrong type for Iterate method)
		have Iterate(.shape.int_0)
		want Iterate(R₄)

goroutine 1 [running]:
runtime/debug.Stack()
	/root/master/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x41e000, 0xc0}, {0xcf83f4, 0x27}, {0xc0000c2da8, 0x3, 0x3})
	/root/master/go/src/cmd/compile/internal/base/print.go:227 +0x154
cmd/compile/internal/base.Fatalf(...)
	/root/master/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/noder.assignconvfn({0xe4dd90, 0xc00006fdb0}, 0xc00007ff10)
	/root/master/go/src/cmd/compile/internal/noder/transform.go:417 +0x1b2
cmd/compile/internal/noder.transformAssign({0xe4d430, 0xc00006fd60}, {0xc0000c3040, 0x1, 0x2}, {0xc0000c3030, 0x1, 0x7fc9fbacef80})
	/root/master/go/src/cmd/compile/internal/noder/transform.go:363 +0x4b3
cmd/compile/internal/noder.(*subster).node.func1({0xe4d430, 0xc00006ed20})
	/root/master/go/src/cmd/compile/internal/noder/stencil.go:981 +0x5a5
cmd/compile/internal/noder.(*subster).node(0xc000412b60, {0xe4d430, 0xc00006ed20})
	/root/master/go/src/cmd/compile/internal/noder/stencil.go:1166 +0xa5
cmd/compile/internal/noder.(*subster).list(0x13b9620, {0xc000062ca0, 0x2, 0xc0000b4550})
	/root/master/go/src/cmd/compile/internal/noder/stencil.go:1418 +0x8e
cmd/compile/internal/noder.(*irgen).genericSubst(0xc00040e000, 0xc00006fc20, 0xc00007dba0, {0xc00000e330, 0x1, 0x1}, 0x0, 0xc00000c660)
	/root/master/go/src/cmd/compile/internal/noder/stencil.go:762 +0xce6
cmd/compile/internal/noder.(*irgen).getInstantiation(0xc00040e000, 0xc00007dba0, {0xc00000e328, 0x1, 0x1}, 0xc8)
	/root/master/go/src/cmd/compile/internal/noder/stencil.go:640 +0x2b0
cmd/compile/internal/noder.(*irgen).stencil.func1({0xe4d818, 0xc0004022d0})
	/root/master/go/src/cmd/compile/internal/noder/stencil.go:108 +0x2df
cmd/compile/internal/ir.Visit.func1({0xe4d818, 0xc0004022d0})
	/root/master/go/src/cmd/compile/internal/ir/visit.go:105 +0x30
cmd/compile/internal/ir.doNodes({0xc00002e4c0, 0x1, 0x0}, 0xc00000c648)
	/root/master/go/src/cmd/compile/internal/ir/node_gen.go:1512 +0x67
cmd/compile/internal/ir.(*Func).doChildren(0xe4e178, 0xc000072580)
	/root/master/go/src/cmd/compile/internal/ir/func.go:152 +0x2e
cmd/compile/internal/ir.DoChildren(...)
	/root/master/go/src/cmd/compile/internal/ir/visit.go:94
cmd/compile/internal/ir.Visit.func1({0xe4e178, 0xc000072580})
	/root/master/go/src/cmd/compile/internal/ir/visit.go:106 +0x57
cmd/compile/internal/ir.Visit({0xe4e178, 0xc000072580}, 0xc000076e80)
	/root/master/go/src/cmd/compile/internal/ir/visit.go:108 +0xb8
cmd/compile/internal/noder.(*irgen).stencil(0xc00040e000)
	/root/master/go/src/cmd/compile/internal/noder/stencil.go:90 +0x238
cmd/compile/internal/noder.(*irgen).generate(0xc00040e000, {0xc00008ab60, 0x2, 0xb})
	/root/master/go/src/cmd/compile/internal/noder/irgen.go:301 +0x359
cmd/compile/internal/noder.check2({0xc00008ab60, 0x2, 0x2})
	/root/master/go/src/cmd/compile/internal/noder/irgen.go:93 +0x175
cmd/compile/internal/noder.LoadPackage({0xc0000b0110, 0x2, 0x0})
	/root/master/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd0ba30)
	/root/master/go/src/cmd/compile/internal/gc/main.go:190 +0xaf3
main.main()
	/root/master/go/src/cmd/compile/main.go:55 +0xdd

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions