Skip to content

Commit 0618956

Browse files
cuonglmheschi
authored andcommitted
[release-branch.go1.19] 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 #56106 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]> Reviewed-on: https://go-review.googlesource.com/c/go/+/441995 Reviewed-by: Joedian Reid <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent e73130c commit 0618956

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 11 additions & 0 deletions
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)