mirror of
https://github.com/golang/go.git
synced 2026-01-29 07:02:05 +03:00
When generating equality signatures for arrays with zero-size ASPECIAL
elements (e.g., [3]struct{_ [0]float64}), the compiler crashed with
a divide by zero error when computing the loop unroll factor.
Skip comparison code generation for zero-size elements since they
need no comparison.
Fixes #77303
Change-Id: Ib432cfece22b1cb714de4f0a0b0d1a2d89bb0d33
Reviewed-on: https://go-review.googlesource.com/c/go/+/738841
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
20 lines
362 B
Go
20 lines
362 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.
|
|
|
|
// Issue 77303: compiler crash on array of zero-size ASPECIAL elements.
|
|
|
|
package p
|
|
|
|
type zeroSizeSpecial struct {
|
|
_ [0]float64
|
|
}
|
|
|
|
var x [3]zeroSizeSpecial
|
|
|
|
func f() bool {
|
|
return x == x
|
|
}
|