Files
golang.go/test/fixedbugs/issue78410.go
Cuong Manh Le 9002bd9fa1 cmd/compile: ensure map/slice clearing expressions are walked
The order pass ensures that initialization operations for clear(expr)
are scheduled. However, if 'expr' is a conversion that the walk pass
subsequently optimizes away or transforms, the resulting nodes can
be left in an un-walked state.

These un-walked nodes reach the SSA backend, which does not expect
high-level IR, resulting in an ICE.

This change ensures the expression is always walked during the
transformation of the 'clear' builtin.

Fixes #78410

Change-Id: I1997a28af020f39b2d325a58429eff9495048b1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/760981
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2026-03-31 10:58:53 -07:00

10 lines
237 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
func f() { clear([]byte{string([]byte{'x'}[:])[0]}) }