Skip to content

Commit fce4496

Browse files
cuonglmgopherbot
authored andcommitted
cmd/compile: fix missing walk pass for static initialization slice
CL 403995 fixed static init of literal contains dynamic exprs, by ensuring their init are ordered properly. However, we still need to walk the generated init codes before appending to parent init. Otherwise, codes that requires desugaring will be unhandled, causing the compiler backend crashing. Fixes #56105 Change-Id: Ic25fd4017473f5412c8e960a91467797a234edfd Reviewed-on: https://go-review.googlesource.com/c/go/+/440455 Reviewed-by: Matthew Dempsky <[email protected]> Auto-Submit: Cuong Manh Le <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Keith Randall <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 506e690 commit fce4496

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/cmd/compile/internal/walk/complit.go

+1
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ func fixedlit(ctxt initContext, kind initKind, n *ir.CompLitExpr, var_ ir.Node,
243243
// confuses about variables lifetime. So making sure those expressions
244244
// are ordered correctly here. See issue #52673.
245245
orderBlock(&sinit, map[string][]*ir.Name{})
246+
walkStmtList(sinit)
246247
}
247248
init.Append(sinit...)
248249
continue

test/fixedbugs/issue56105.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// compile -d=libfuzzer
2+
3+
// Copyright 2022 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
package p
8+
9+
func f() {
10+
_ = [...][]int{{}, {}, {}, {}, {}}
11+
}

0 commit comments

Comments
 (0)