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 go.shape.int_0 -> main.F.T #53439

Closed
ALTree opened this issue Jun 18, 2022 · 5 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Jun 18, 2022

$ gotip version
go version devel go1.19-527ace0ffa Sat Jun 18 00:48:50 2022 +0000 linux/amd64
package main

import "unsafe"

func F[T int](v T) uintptr {
	return unsafe.Offsetof(struct{ f T }{
		func(T) T { return v }(v),
	}.f)
}

func main() {
	println(F(1))
}
$ gotip build crash.go
# command-line-arguments
./crash.go:7:25: internal compiler error: found illegal assignment go.shape.int_0 -> main.F.T; 

goroutine 1 [running]:
runtime/debug.Stack()
	./gotip/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x0?, 0x0?}, {0xd560d3, 0x27}, {0xc000412468, 0x3, 0x3})
	./gotip/src/cmd/compile/internal/base/print.go:227 +0x1d7
cmd/compile/internal/base.Fatalf(...)
	./gotip/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/noder.assignconvfn({0xeadd88, 0xc0003fdb80}, 0xc0003e12d0)
	./gotip/src/cmd/compile/internal/noder/transform.go:482 +0x1b2
cmd/compile/internal/noder.typecheckaste(0xc0?, {0xc0001726c0?, 0xeacb90?}, 0x0, 0x0?, {0xc00005ef80, 0x1, 0xc00005ef80?})
	./gotip/src/cmd/compile/internal/noder/transform.go:558 +0x16b
cmd/compile/internal/noder.transformCall(0xc0001726c0)
	./gotip/src/cmd/compile/internal/noder/transform.go:188 +0x1b6
cmd/compile/internal/noder.(*subster).node.func1({0xeacb90, 0xc000172240})
	./gotip/src/cmd/compile/internal/noder/stencil.go:1135 +0xe13
cmd/compile/internal/ir.editNodes(...)
	./gotip/src/cmd/compile/internal/ir/node_gen.go:1388
cmd/compile/internal/ir.(*CompLitExpr).editChildren(0xc000418380, 0xc000011db8)
	./gotip/src/cmd/compile/internal/ir/node_gen.go:359 +0xf5
cmd/compile/internal/ir.EditChildren(...)
	./gotip/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/noder.(*subster).node.func1({0xeace70, 0xc0003e1b90})
	./gotip/src/cmd/compile/internal/noder/stencil.go:994 +0x5b6
cmd/compile/internal/ir.(*SelectorExpr).editChildren(0xc000069d40, 0xc000011db8)
	./gotip/src/cmd/compile/internal/ir/node_gen.go:1012 +0x62
cmd/compile/internal/ir.EditChildren(...)
	./gotip/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/noder.(*subster).node.func1({0xeae348, 0xc000069bc0})
	./gotip/src/cmd/compile/internal/noder/stencil.go:994 +0x5b6
cmd/compile/internal/ir.editNodes(...)
	./gotip/src/cmd/compile/internal/ir/node_gen.go:1388

...

Likely related to #53390, either uncovered or caused by its fix.

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 18, 2022
@ALTree ALTree added this to the Go1.19 milestone Jun 18, 2022
@ALTree
Copy link
Member Author

ALTree commented Jun 18, 2022

(does not crash on UNIFIED)

@cuonglm cuonglm self-assigned this Jun 18, 2022
@cuonglm cuonglm added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jun 18, 2022
@gopherbot
Copy link

Change https://go.dev/cl/413114 mentions this issue: cmd/compile: only skip visit closures in generic function call

@dmitshur dmitshur added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 12, 2022
@mdempsky
Copy link
Member

@ALTree This is a synthetic test case, like constructed by a fuzzer, right?

I think we can punt on this for 1.19. It's unfortunate that the non-unified frontend has such trouble with unsafe.{Align,Offset,Size}of and function literals, but I don't think it's worth investing any further engineering resources into fixing at this time.

I expect 1.20 will fix this by switching to Unified IR.

@mdempsky mdempsky modified the milestones: Go1.19, Go1.20 Jul 12, 2022
@ALTree
Copy link
Member Author

ALTree commented Jul 13, 2022

It's a side effect of the fix for #53390 which itself is from a fuzzer so nothing urgent here.

@gopherbot
Copy link

Change https://go.dev/cl/449756 mentions this issue: test: add regression test for issue 53439

@golang golang locked and limited conversation to collaborators Nov 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants