Skip to content

cmd/compile: "bad type" ICE via very large arrays as arguments #80896

Closed

Description

@lmaltsis

Go version

go version go1.28-devel_72aa6db794 Sat Aug 15 05:08:36 2026 -0700 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go-1.22'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go-1.22/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1892574832=/tmp/go-build -gno-record-gcc-switches'

What did you do?

https://go.dev/play/p/vFbGYvcpIpM?v=gotip

package main

const N = 2e6

type Big = [4 * 3 * N * N]int

func sink(x Big) {}

func h(x0, x1, x2 Big) {
	sink(x0)
	sink(x1)
	sink(x2)
}

What did you see happen?

/prog.go:7:6: internal compiler error: bad type: func([48000000000000]int, [48000000000000]int, [48000000000000]int)

goroutine 1 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:26 +0x5e
cmd/compile/internal/base.FatalfAt({0x2?, 0x7060?}, {0x1048c97, 0xc}, {0x171821913180, 0x1, 0x1})
	/usr/local/go/src/cmd/compile/internal/base/print.go:232 +0x18b
cmd/compile/internal/base.Fatalf(...)
	/usr/local/go/src/cmd/compile/internal/base/print.go:197
cmd/compile/internal/types.typePos(0x2ba7def300000?)
	/usr/local/go/src/cmd/compile/internal/types/size.go:54 +0x90
cmd/compile/internal/types.calcStructOffset(...)
	/usr/local/go/src/cmd/compile/internal/types/size.go:191
cmd/compile/internal/types.CalcSize(0x171821c96300)
	/usr/local/go/src/cmd/compile/internal/types/size.go:437 +0x1325
cmd/compile/internal/types.ResumeCheckSize(...)
	/usr/local/go/src/cmd/compile/internal/types/size.go:722
cmd/compile/internal/types.CalcSize(0x171821c1f2c0)
	/usr/local/go/src/cmd/compile/internal/types/size.go:459 +0x10a5
cmd/compile/internal/gc.prepareFunc(0x171821c0c780)
	/usr/local/go/src/cmd/compile/internal/gc/compile.go:116 +0xc5
cmd/compile/internal/gc.enqueueFunc(...)
	/usr/local/go/src/cmd/compile/internal/gc/compile.go:86
cmd/compile/internal/gc.Main(0x1a74090)
	/usr/local/go/src/cmd/compile/internal/gc/main.go:334 +0x329c
main.main()
	/usr/local/go/src/cmd/compile/main.go:57 +0x105

What did you expect to see?

stack frame too large (>1GB)

Activity

  1. changed the title [-]cmd/compile: ice via very large arrays as arguments[/-] [+]cmd/compile: ice bad type via very large arrays as arguments[/+] on Aug 16, 2026
  2. gopherbot commented on Aug 16, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/816020 mentions this issue: cmd/compile: fix ICE when functions have params with very large offsets

  3. added
    FixPendingIssues that have a fix which has not yet been reviewed or submitted.
    on Aug 16, 2026
  4. self-assigned this
    on Aug 16, 2026
  5. added this to the Go1.28 milestone on Aug 18, 2026
  6. changed the title [-]cmd/compile: ice bad type via very large arrays as arguments[/-] [+]cmd/compile: "bad type" ICE via very large arrays as arguments[/+] on Aug 18, 2026
  7. added a commit that references this issue on Aug 19, 2026
    5aaedc8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.compiler/runtimeIssues related to the Go compiler and/or runtime.help wanted

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions