Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: internal compiler error: found illegal assignment .shape.*uint8_1 -> PTR-*string; #48453

Closed
dominikh opened this issue Sep 18, 2021 · 3 comments

Comments

@dominikh
Copy link
Member

@dominikh dominikh commented Sep 18, 2021

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

$ go version
go version devel go1.18-4b654c0eec Fri Sep 17 23:44:10 2021 +0000 linux/amd64

What did you do?

package pkg

func CopyMap[M interface{ ~map[K]V }, K comparable, V any](m M) M {
	out := make(M, len(m))
	for k, v := range m {
		out[k] = v
	}
	return out
}

func fn() {
	var m map[*string]int
	CopyMap(m)
}

What did you see instead?

./foo.go:13:10: internal compiler error: found illegal assignment .shape.*uint8_1 -> PTR-*string; 

goroutine 1 [running]:
runtime/debug.Stack()
	/home/dominikh/prj/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x0, 0x0}, {0xcf4004, 0x27}, {0xc0000f2a80, 0x3, 0x3})
	/home/dominikh/prj/go/src/cmd/compile/internal/base/print.go:227 +0x154
cmd/compile/internal/base.Fatalf(...)
	/home/dominikh/prj/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/noder.assignconvfn({0xe498d8, 0xc000463520}, 0xc000430f50)
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/transform.go:417 +0x1b2
cmd/compile/internal/noder.transformIndex(0xc0004587e0)
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/transform.go:244 +0xda
cmd/compile/internal/noder.(*subster).node.func1({0xe49040, 0xc0004586c0})
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/stencil.go:972 +0x716
cmd/compile/internal/ir.(*AssignStmt).editChildren(0xc000465540, 0xc00000dd88)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/node_gen.go:160 +0x58
cmd/compile/internal/ir.EditChildren(...)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/noder.(*subster).node.func1({0xe47f10, 0xc000464280})
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/stencil.go:958 +0x448
cmd/compile/internal/ir.editNodes({0xc0000b8fa0, 0x1, 0xcb7400}, 0xc00000dd88)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/node_gen.go:1521 +0x74
cmd/compile/internal/ir.(*RangeStmt).editChildren(0xc0001c2990, 0xc00000dd88)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/node_gen.go:1000 +0x16c
cmd/compile/internal/ir.EditChildren(...)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/noder.(*subster).node.func1({0xe49bf8, 0xc0001c2480})
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/stencil.go:958 +0x448
cmd/compile/internal/noder.(*subster).node(0xc0004315e0, {0xe49bf8, 0xc0001c2480})
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/stencil.go:1169 +0xa5
cmd/compile/internal/noder.(*subster).list(0xc00000e6c8, {0xc00045e1c0, 0x3, 0xc0000ce5a0})
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/stencil.go:1421 +0x8e
cmd/compile/internal/noder.(*irgen).genericSubst(0xc000460000, 0xc0004652c0, 0xc0004621a0, {0xc00000dce0, 0x3, 0x3}, 0x0, 0xc00000dcf8)
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/stencil.go:765 +0xce6
cmd/compile/internal/noder.(*irgen).getInstantiation(0xc000460000, 0xc0004621a0, {0xc00000dcc8, 0x3, 0x3}, 0x58)
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/stencil.go:643 +0x2b0
cmd/compile/internal/noder.(*irgen).stencil.func1({0xe482f8, 0xc0001c2510})
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/stencil.go:108 +0x2df
cmd/compile/internal/ir.Visit.func1({0xe482f8, 0xc0001c2510})
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/visit.go:105 +0x30
cmd/compile/internal/ir.doNodes({0xc00045e2c0, 0x3, 0x0}, 0xc00000dcb0)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/node_gen.go:1512 +0x67
cmd/compile/internal/ir.(*Func).doChildren(0xe48c58, 0xc000454840)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/func.go:152 +0x2e
cmd/compile/internal/ir.DoChildren(...)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/visit.go:94
cmd/compile/internal/ir.Visit.func1({0xe48c58, 0xc000454840})
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/visit.go:106 +0x57
cmd/compile/internal/ir.Visit({0xe48c58, 0xc000454840}, 0xc00045e300)
	/home/dominikh/prj/go/src/cmd/compile/internal/ir/visit.go:108 +0xb8
cmd/compile/internal/noder.(*irgen).stencil(0xc000460000)
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/stencil.go:90 +0x238
cmd/compile/internal/noder.(*irgen).generate(0xc000460000, {0xc00000e458, 0x1, 0x2})
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/irgen.go:301 +0x359
cmd/compile/internal/noder.check2({0xc00000e458, 0x1, 0x1})
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/irgen.go:93 +0x175
cmd/compile/internal/noder.LoadPackage({0xc00001e1d0, 0x1, 0x0})
	/home/dominikh/prj/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd07420)
	/home/dominikh/prj/go/src/cmd/compile/internal/gc/main.go:190 +0xaf3
main.main()
	/home/dominikh/prj/go/src/cmd/compile/main.go:55 +0xdd
@dominikh
Copy link
Member Author

@dominikh dominikh commented Sep 18, 2021

Bisects to

commit cfa233d76bcff00f46f5e5acdb17cb819a309d2b
Author: Dan Scales <danscales@google.com>
Date:   Sun Sep 12 12:21:48 2021 -0700

    cmd/compile: remove unneeded early transforms, with dictionary change
    
    Now that we are computing the dictionary format on the instantiated
    functions, we can remove the early transformation code that was needed
    to create the implicit CONVIFACE nodes in the generic function.

/cc @danscales

Loading

@ALTree ALTree added this to the Go1.18 milestone Sep 18, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 18, 2021

Change https://golang.org/cl/350692 mentions this issue: cmd/compile: permit shaped pointer in assignop

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 20, 2021

Change https://golang.org/cl/350949 mentions this issue: cmd/compile: fix transform.AssignOp to deal with tricky case

Loading

@gopherbot gopherbot closed this in b6dddac Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants