Skip to content

cmd/compile: ICE assertion failed with append(nil, "string"...) #76220

@anderseknert

Description

@anderseknert

Go version

go version go1.25.4 darwin/arm64

Output of go env in your module/workspace:

-

What did you do?

This is nonsense code, obviously. But the panic happened while doing real work and just having my code in a temporarily broken state as I was rewriting parts of it, which had gopls crash. Minimal repro:

package main

func main() {
	s := "hello"
	msg := append(nil, s...)
	print(msg)
}

What did you see happen?

gopls crash consistently, so I also tried go run

go run main.go
# command-line-arguments
<unknown line number>: internal compiler error: panic: cmd/compile/internal/types2/builtins.go:1093: assertion failed

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

What did you expect to see?

A compiler error without the panic. 1.24 seems to do the right thing:

go version
go version go1.24.2 darwin/arm64

go run main.go
# command-line-arguments
./main.go:5:16: first argument to append must be a slice; have untyped nil

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.compiler/runtimeIssues related to the Go compiler and/or runtime.release-blocker

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions