Skip to content

cmd/compile: internal compiler error: misuse of CaptureName on closure variable #47684

Closed

Description

@ALTree
$ gotip version
go version devel go1.18-4c8ffb3baa Fri Aug 13 00:20:28 2021 +0000 linux/amd64

Was playing around with -G=3 after the dev.typeparams merge into master.

package main

func f[G any]() int {
	return func() int {
		return func() int {
			return 0
		}()
	}()
}

func main() {
	f[int]()
}
$ gotip tool compile -G=3 crash.go

crash.go:5:10: internal compiler error: misuse of CaptureName on closure variable: .dict

goroutine 1 [running]:
runtime/debug.Stack()
	/home/alberto/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x401ba0, 0xc0}, {0xd0af82, 0x2d}, {0xc000114240, 0x1, 0x1})
	/home/alberto/go/src/cmd/compile/internal/base/print.go:227 +0x154
cmd/compile/internal/ir.CaptureName({0x40b2c0, 0xc0}, 0xc000402f20, 0xc00040e680)
	/home/alberto/go/src/cmd/compile/internal/ir/name.go:408 +0x8d
cmd/compile/internal/noder.(*subster).node.func1({0xe5eb90, 0xc0003f7ea0})
	/home/alberto/go/src/cmd/compile/internal/noder/stencil.go:1077 +0x118c
cmd/compile/internal/ir.(*CallExpr).editChildren(0xc0001726c0, 0xc00000db30)
	/home/alberto/go/src/cmd/compile/internal/ir/node_gen.go:274 +0x58
cmd/compile/internal/ir.EditChildren(...)

cc @danscales @randall77

Activity

  1. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Aug 13, 2021
  2. self-assigned this
    on Aug 13, 2021
  3. gopherbot commented on Aug 13, 2021

    @gopherbot
    Contributor

    Change https://golang.org/cl/342050 mentions this issue: cmd/compile: fix dictionaries for nested closures

  4. gopherbot commented on Aug 16, 2021

    @gopherbot
    Contributor

    Change https://golang.org/cl/342529 mentions this issue: [dev.typeparams] cmd/compile: fix dictionaries for nested closures

  5. gopherbot commented on Aug 20, 2021

    @gopherbot
    Contributor

    Change https://golang.org/cl/343871 mentions this issue: cmd/compile: copy captured dictionary var to local var

  6. locked and limited conversation to collaborators on Jun 23, 2023
  7. added a commit that references this issue on Apr 29, 2024
    5a40100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions