Files
golang.go/test/fixedbugs/issue77868.go
Mateusz Poliwczak b16360470c cmd/compile: fix ICE when indexing zero-sized arrays of non-SSAable types
Fixes #77868

Change-Id: I3348825e24a71595c514113497db365a6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/749881
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
2026-03-04 13:26:19 -08:00

21 lines
416 B
Go

// compile
// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
type S struct {
n int
a [2]int
}
func f(i int) int {
var arr [0]S
// Accessing a zero-length array must not trigger an internal compiler error.
// This code is invalid, but make sure that we can compile it.
return arr[i].n
}