]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/reflectdata: fix divide by zero for zero-size array elements
authorfumiyanokesinn <shindori238@gmail.com>
Sun, 25 Jan 2026 14:59:25 +0000 (23:59 +0900)
committerGopher Robot <gobot@golang.org>
Tue, 27 Jan 2026 02:28:40 +0000 (18:28 -0800)
commitcf0c42c2ca04c3ae9fa20ce9dd4f6bce301bd37b
treef7906d370423297fe9913fb13eddd732160f78f3
parentbb221e8954b639e8790fd1d4a8cd35ff3a9340aa
cmd/compile/internal/reflectdata: fix divide by zero for zero-size array elements

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>
src/cmd/compile/internal/reflectdata/alg.go
test/fixedbugs/issue77303.go [new file with mode: 0644]