Skip to content

cmd/compile: internal compiler error: unused auto: .autotmp_4 #62515

Closed
@ALTree

Description

@ALTree
$ gotip version
go version devel go1.22-d9a4b24a Thu Sep 7 15:25:07 2023 +0000 linux/amd64
package main

import "unsafe"

func F[G int](g G) uintptr {
	var c chan func() int
	type s struct {
		_ G
		_ []int
	}
	return unsafe.Sizeof(s{g, make([]int, (<-c)())})
}

func main() {
	F(0)
}
$ gotip build crash.go 

# command-line-arguments
./crash.go:11:45: internal compiler error: unused auto: .autotmp_4

goroutine 1 [running]:
runtime/debug.Stack()
	./desktop/gotip/src/runtime/debug/stack.go:24 +0x5e
cmd/compile/internal/base.FatalfAt({0xcfa3e0?, 0x0?}, {0xd6fb2e, 0xf}, {0xc000409468, 0x1, 0x1})
	./desktop/gotip/src/cmd/compile/internal/base/print.go:225 +0x1d7
cmd/compile/internal/inline.pruneUnusedAutos({0xc00040c6c0, 0x5, 0x1?}, 0xc00040cbc0)
	./desktop/gotip/src/cmd/compile/internal/inline/inl.go:1176 +0x185
cmd/compile/internal/inline.CanInline(0xc000412000, 0x0)
...

Doesn't crash on 1.21

cc @golang/compiler

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions