diff options
author | Iskander Sharipov <iskander.sharipov@intel.com> | 2018-09-19 15:53:03 +0300 |
---|---|---|
committer | Iskander Sharipov <iskander.sharipov@intel.com> | 2018-09-20 09:46:11 +0000 |
commit | 499fbb1a8ae20a69aa7f49287c65eec845963a30 (patch) | |
tree | c01eb3c07a3b090048b81e461898a02ea5593ca4 /test/escape2.go | |
parent | 9a033bf9d3f5f7485d82836ec95e51a3fa74a926 (diff) | |
download | go-499fbb1a8ae20a69aa7f49287c65eec845963a30.tar.gz go-499fbb1a8ae20a69aa7f49287c65eec845963a30.zip |
cmd/compile/internal/gc: unify self-assignment checks in esc.go
Move slice self-assign check into isSelfAssign function.
Make debug output consistent for all self-assignment cases.
Change-Id: I0e4cc7b3c1fcaeace7226dd80a0dc1ea97347a55
Reviewed-on: https://go-review.googlesource.com/136276
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/escape2.go')
-rw-r--r-- | test/escape2.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/escape2.go b/test/escape2.go index 5c4c803249..a39291e855 100644 --- a/test/escape2.go +++ b/test/escape2.go @@ -1602,10 +1602,10 @@ type Buffer struct { } func (b *Buffer) foo() { // ERROR "\(\*Buffer\).foo b does not escape$" - b.buf1 = b.buf1[1:2] // ERROR "\(\*Buffer\).foo ignoring self-assignment to b.buf1$" - b.buf1 = b.buf1[1:2:3] // ERROR "\(\*Buffer\).foo ignoring self-assignment to b.buf1$" - b.buf1 = b.buf2[1:2] // ERROR "\(\*Buffer\).foo ignoring self-assignment to b.buf1$" - b.buf1 = b.buf2[1:2:3] // ERROR "\(\*Buffer\).foo ignoring self-assignment to b.buf1$" + b.buf1 = b.buf1[1:2] // ERROR "\(\*Buffer\).foo ignoring self-assignment in b.buf1 = b.buf1\[1:2\]$" + b.buf1 = b.buf1[1:2:3] // ERROR "\(\*Buffer\).foo ignoring self-assignment in b.buf1 = b.buf1\[1:2:3\]$" + b.buf1 = b.buf2[1:2] // ERROR "\(\*Buffer\).foo ignoring self-assignment in b.buf1 = b.buf2\[1:2\]$" + b.buf1 = b.buf2[1:2:3] // ERROR "\(\*Buffer\).foo ignoring self-assignment in b.buf1 = b.buf2\[1:2:3\]$" } func (b *Buffer) bar() { // ERROR "leaking param: b$" @@ -1613,13 +1613,13 @@ func (b *Buffer) bar() { // ERROR "leaking param: b$" } func (b *Buffer) arrayPtr() { // ERROR "\(\*Buffer\).arrayPtr b does not escape" - b.buf1 = b.arrPtr[1:2] // ERROR "\(\*Buffer\).arrayPtr ignoring self-assignment to b.buf1" - b.buf1 = b.arrPtr[1:2:3] // ERROR "\(\*Buffer\).arrayPtr ignoring self-assignment to b.buf1" + b.buf1 = b.arrPtr[1:2] // ERROR "\(\*Buffer\).arrayPtr ignoring self-assignment in b.buf1 = b.arrPtr\[1:2\]$" + b.buf1 = b.arrPtr[1:2:3] // ERROR "\(\*Buffer\).arrayPtr ignoring self-assignment in b.buf1 = b.arrPtr\[1:2:3\]$" } func (b *Buffer) baz() { // ERROR "\(\*Buffer\).baz b does not escape$" - b.str1 = b.str1[1:2] // ERROR "\(\*Buffer\).baz ignoring self-assignment to b.str1$" - b.str1 = b.str2[1:2] // ERROR "\(\*Buffer\).baz ignoring self-assignment to b.str1$" + b.str1 = b.str1[1:2] // ERROR "\(\*Buffer\).baz ignoring self-assignment in b.str1 = b.str1\[1:2\]$" + b.str1 = b.str2[1:2] // ERROR "\(\*Buffer\).baz ignoring self-assignment in b.str1 = b.str2\[1:2\]$" } func (b *Buffer) bat() { // ERROR "leaking param content: b$" @@ -1629,8 +1629,8 @@ func (b *Buffer) bat() { // ERROR "leaking param content: b$" } func quux(sp *string, bp *[]byte) { // ERROR "quux bp does not escape$" "quux sp does not escape$" - *sp = (*sp)[1:2] // ERROR "quux ignoring self-assignment to \*sp$" - *bp = (*bp)[1:2] // ERROR "quux ignoring self-assignment to \*bp$" + *sp = (*sp)[1:2] // ERROR "quux ignoring self-assignment in \*sp = \(\*sp\)\[1:2\]$" + *bp = (*bp)[1:2] // ERROR "quux ignoring self-assignment in \*bp = \(\*bp\)\[1:2\]$" } type StructWithString struct { |