]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: check order temp has correct type
authorKeith Randall <khr@google.com>
Mon, 15 Oct 2018 16:44:22 +0000 (09:44 -0700)
committerKeith Randall <khr@golang.org>
Mon, 15 Oct 2018 17:56:35 +0000 (17:56 +0000)
Followon from CL 140306

Change-Id: Ic71033d2301105b15b60645d895a076107f44a2e
Reviewed-on: https://go-review.googlesource.com/c/142178
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/gc/sinit.go

index d520f21e63af6c4b90306ffa3219b4e6c781a691..f24da706252ac51daea28f8b4b4eb5dc180da6de 100644 (file)
@@ -833,7 +833,9 @@ func slicelit(ctxt initContext, n *Node, var_ *Node, init *Nodes) {
        var a *Node
        if x := prealloc[n]; x != nil {
                // temp allocated during order.go for dddarg
-               x.Type = t
+               if !eqtype(t, x.Type) {
+                       panic("dotdotdot base type does not match order's assigned type")
+               }
 
                if vstat == nil {
                        a = nod(OAS, x, nil)