]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: s.f aliases itself
authorIan Lance Taylor <iant@golang.org>
Thu, 31 Mar 2016 20:58:33 +0000 (13:58 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 1 Apr 2016 00:47:56 +0000 (00:47 +0000)
commit92bb694a493723d901a253bc88be53a207c8d550
tree459dcb8b4084e35a234d13fe337291ac0d83db43
parent1bf779a44a924650885111c6161c0c5a22968dbf
cmd/compile: s.f aliases itself

The change in 20907 fixed varexpr but broke aliased.  After that change,
a reference to a field in a struct would not be seen as aliasing itself.
Before that change, it would, but only because all fields in a struct
aliased everything.

This CL changes the compiler to consider all references to a field as
aliasing all other fields in that struct.  This is imperfect--a
reference to one field does not alias another field--but is a simple fix
for the immediate problem.  A better fix would require tracking the
specific fields as well.

Fixes #15042.

Change-Id: I5c95c0dd7b0699e53022fce9bae2e8f50d6d1d04
Reviewed-on: https://go-review.googlesource.com/21390
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/walk.go
test/fixedbugs/issue15042.go [new file with mode: 0644]