]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: cgen_append can handle complex targets
authorKeith Randall <khr@golang.org>
Tue, 7 Jun 2016 22:43:48 +0000 (15:43 -0700)
committerKeith Randall <khr@golang.org>
Wed, 8 Jun 2016 00:01:09 +0000 (00:01 +0000)
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>
src/cmd/compile/internal/gc/cgen.go
test/fixedbugs/issue15988.go [new file with mode: 0644]

index dbefcc7a0bb52db0a95e884345c6351ba2940087..74fe463dae9ff3a4991084146e13a4d047ac6358 100644 (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")
diff --git a/test/fixedbugs/issue15988.go b/test/fixedbugs/issue15988.go
new file mode 100644 (file)
index 0000000..2bed2a9
--- /dev/null
@@ -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