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: Closure variables from multiple packages #54912

Closed
csgura opened this issue Sep 7, 2022 · 5 comments
Closed

cmd/compile: Closure variables from multiple packages #54912

csgura opened this issue Sep 7, 2022 · 5 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@csgura
Copy link

csgura commented Sep 7, 2022

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

Gotip Playground

What did you do?

https://gotipplay.golang.org/p/W5b3aY-l9VR

What did you expect to see?

No error

What did you see instead?

# play.ground
./lazy/lazy.go:9:6: internal compiler error: Closure variables from multiple packages

goroutine 1 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x6eb311?, 0x0?}, {0xd883b1, 0x28}, {0x0, 0x0, 0x0})
	/usr/local/go/src/cmd/compile/internal/base/print.go:227 +0x1d7
cmd/compile/internal/base.Fatalf(...)
	/usr/local/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/typecheck.ClosureType(0xc0000e86e0)
	/usr/local/go/src/cmd/compile/internal/typecheck/func.go:108 +0x378
cmd/compile/internal/escape.HeapAllocReason({0xeef5c0, 0xc0000e86e0?})
	/usr/local/go/src/cmd/compile/internal/escape/utils.go:200 +0x2d3
cmd/compile/internal/escape.Batch({0xc00002ffb0?, 0x2, 0x2}, 0x30?)
	/usr/local/go/src/cmd/compile/internal/escape/escape.go:158 +0x368
cmd/compile/internal/ir.(*bottomUpVisitor).visit(0xc0003ca090, 0xc0003b4b40)
	/usr/local/go/src/cmd/compile/internal/ir/scc.go:127 +0x303
cmd/compile/internal/ir.VisitFuncsBottomUp({0xc0002faa00, 0x13, 0x2?}, 0xd9bf48)
	/usr/local/go/src/cmd/compile/internal/ir/scc.go:60 +0x112
cmd/compile/internal/escape.Funcs(...)
	/usr/local/go/src/cmd/compile/internal/escape/escape.go:119
cmd/compile/internal/gc.Main(0xd9be38)
	/usr/local/go/src/cmd/compile/internal/gc/main.go:268 +0xf65
main.main()
	/usr/local/go/src/cmd/compile/main.go:57 +0xdd


Go build failed.
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Sep 7, 2022
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 7, 2022
@ianlancetaylor ianlancetaylor added this to the Go1.20 milestone Sep 7, 2022
@ianlancetaylor
Copy link
Contributor

CC @randall77 @mdempsky @cuonglm

@mdempsky mdempsky self-assigned this Sep 7, 2022
@mdempsky
Copy link
Member

mdempsky commented Sep 7, 2022

Further reduced repro: https://go.dev/play/p/aEHwbYsT59O?v=gotip

@cuonglm
Copy link
Member

cuonglm commented Sep 7, 2022

@mdempsky it seems to me that problem happens when we start using runtime dict for unified IR.

@gopherbot
Copy link

Change https://go.dev/cl/428917 mentions this issue: test: add failing test case for inlined type switches

@gopherbot
Copy link

Change https://go.dev/cl/428918 mentions this issue: cmd/compile/internal/noder: correct package for type switch case vars

gopherbot pushed a commit that referenced this issue Sep 7, 2022
The unified frontend ICEs when inlining a function that contains a
function literal, which captures both a type switch case variable and
another variable.

Updates #54912.

Change-Id: I0e16d371ed5df48a70823beb0bf12110a5a17266
Reviewed-on: https://go-review.googlesource.com/c/go/+/428917
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
@golang golang locked and limited conversation to collaborators Sep 7, 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 NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants