1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:20:22 -07:00

cmd/compile: cgen_append can handle complex targets

Post-liveness fix, the slices on both sides can now be
indirects of & variables.  The cgen code handles those
cases just fine.

Fixes #15988

Change-Id: I378ad1d5121587e6107a9879c167291a70bbb9e4
Reviewed-on: https://go-review.googlesource.com/23863
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Keith Randall 2016-06-07 15:43:48 -07:00
parent 41dd1696ab
commit afad74ec30
2 changed files with 14 additions and 5 deletions

View File

@ -2855,11 +2855,6 @@ func cgen_append(n, res *Node) {
Dump("cgen_append-n", n)
Dump("cgen_append-res", res)
}
if res.Op != ONAME && !samesafeexpr(res, n.List.First()) {
Dump("cgen_append-n", n)
Dump("cgen_append-res", res)
Fatalf("append not lowered")
}
for _, n1 := range n.List.Slice() {
if n1.Ullman >= UINF {
Fatalf("append with function call arguments")

View File

@ -0,0 +1,14 @@
// compile
// Copyright 2016 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(p, q []int) {
p = append(q, 5)
sink = &p
}
var sink *[]int