mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: rewrite literal.method to ensure full initialization
CALLPART of STRUCTLIT did not check for incomplete initialization of struct; modify PTRLIT treatment to force zeroing. Test for structlit, believe this might have also failed for arraylit. Fixes #18410. Change-Id: I511abf8ef850e300996d40568944665714efe1fc Reviewed-on: https://go-review.googlesource.com/34622 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
a37b9e8e70
commit
41d2278eef
2 changed files with 42 additions and 0 deletions
|
|
@ -1078,6 +1078,8 @@ func anylit(n *Node, var_ *Node, init *Nodes) {
|
|||
|
||||
var r *Node
|
||||
if n.Right != nil {
|
||||
// n.Right is stack temporary used as backing store.
|
||||
init.Append(nod(OAS, n.Right, nil)) // zero backing store, just in case (#18410)
|
||||
r = nod(OADDR, n.Right, nil)
|
||||
r = typecheck(r, Erv)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue