]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.12] cmd/compile: fix literal struct interface {} lost passing...
authorLE Manh Cuong <cuong.manhle.vn@gmail.com>
Fri, 22 Mar 2019 18:43:06 +0000 (01:43 +0700)
committerAndrew Bonventre <andybons@golang.org>
Tue, 2 Apr 2019 19:43:35 +0000 (19:43 +0000)
commit991583017c856a14431382794a2a2f98ca52e537
treeb89b1b22b65348b3dc2a38818d1bfdf1dd88d38d
parent578e281583f098c67ad5803ed2db1dad436b54d9
[release-branch.go1.12] cmd/compile: fix literal struct interface {} lost passing by value

CL 135377 introduces pass strings and slices to convT2{E,I} by value.
Before that CL, all types, except interface will be allocated temporary
address. The CL changes the logic that only constant and type which
needs address (determine by convFuncName) will be allocated.

It fails to cover the case where type is static composite literal.
Adding condition to check that case fixes the issue.

Also, static composite literal node implies constant type, so consttype
checking can be removed.

Fixes #31209

Change-Id: Ifc750a029fb4889c2d06e73e44bf85e6ef4ce881
Reviewed-on: https://go-review.googlesource.com/c/go/+/168858
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit d47db6dc0ce72d1371c81a677b45d7bdba39ff46)
Reviewed-on: https://go-review.googlesource.com/c/go/+/170437
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/gc/order.go
test/fixedbugs/issue30956.go [new file with mode: 0644]
test/fixedbugs/issue30956.out [new file with mode: 0644]