aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorMateusz Poliwczak <mpoliwczak34@gmail.com>2026-02-28 12:05:10 +0100
committerGopher Robot <gobot@golang.org>2026-03-04 13:26:19 -0800
commitb16360470c1eb574e8b7fa7a606810bf7cb6df7c (patch)
tree3445f4e98a633fdc74e71dbab180d1d14969e704 /src/cmd
parent50126a8e44f76134349edf5ba3cc94efabc61c80 (diff)
downloadgo-b16360470c1eb574e8b7fa7a606810bf7cb6df7c.tar.xz
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>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/ssagen/ssa.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go
index a86c940356..864f1708f8 100644
--- a/src/cmd/compile/internal/ssagen/ssa.go
+++ b/src/cmd/compile/internal/ssagen/ssa.go
@@ -3555,9 +3555,9 @@ func (s *state) exprCheckPtr(n ir.Node, checkPtrOK bool) *ssa.Value {
// use constants for the bounds check.
z := s.constInt(types.Types[types.TINT], 0)
s.boundsCheck(z, z, ssa.BoundsIndex, false)
- // The return value won't be live, return junk.
- // But not quite junk, in case bounds checks are turned off. See issue 48092.
- return s.zeroVal(n.Type())
+ // The return value won't be live. In case bounds checks
+ // are turned off, load from (*T)(nil) to cause a segfault.
+ return s.load(n.Type(), s.constNil(n.Type().PtrTo()))
}
len := s.constInt(types.Types[types.TINT], bound)
s.boundsCheck(i, len, ssa.BoundsIndex, n.Bounded()) // checks i == 0