Skip to content

cmd/compile: internal compiler error: 'F-range1': panic during short circuit while compiling F-range1 #78408

@jake-ciolek

Description

@jake-ciolek

Go version

go 1.26.1 + tip

Output of go env in your module/workspace:

GOARCH=arm64

What did you do?

package p

func F() {
A:
	for range (func(func() bool))(nil) {
		_ = func() { A: goto A }
		goto A
	}
}

Ran go build on the above.

What did you see happen?

./main.go:5:2: internal compiler error: 'F-range1': panic during short circuit while compiling F-range1:

runtime error: index out of range [0] with length 0

goroutine 12 [running]:
cmd/compile/internal/ssa.Compile.func1()
	cmd/compile/internal/ssa/compile.go:49 +0x60
panic({0x1041ac040?, 0x52927f5cd170?})
	runtime/panic.go:860 +0x12c
cmd/compile/internal/ssa.fuseBlockPlain(0x52927faedb78?)
	cmd/compile/internal/ssa/fuse.go:199 +0x6a4
cmd/compile/internal/ssa.fuse(...)
	cmd/compile/internal/ssa/fuse.go:54
cmd/compile/internal/ssa.shortcircuit(0x52927faca380)
	cmd/compile/internal/ssa/shortcircuit.go:61 +0xdc
cmd/compile/internal/ssa.Compile(0x52927faca380)
	cmd/compile/internal/ssa/compile.go:97 +0xa7c
cmd/compile/internal/ssagen.buildssa(0x52927f977680, 0x6, 0x0)
	cmd/compile/internal/ssagen/ssa.go:594 +0x23f8
cmd/compile/internal/ssagen.Compile(0x52927f977680, 0x6, 0x0?)
	cmd/compile/internal/ssagen/pgen.go:304 +0x70
cmd/compile/internal/gc.compileFunctions.func5.1(0x52927f98a1c0?)
	cmd/compile/internal/gc/compile.go:199 +0x38
cmd/compile/internal/gc.compileFunctions.func3.1()
	cmd/compile/internal/gc/compile.go:181 +0x34
created by cmd/compile/internal/gc.compileFunctions.func3 in goroutine 10
	cmd/compile/internal/gc/compile.go:180 +0x274



Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

What did you expect to see?

No ICE.

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions