mirror of
https://github.com/golang/go
synced 2024-11-18 00:04:43 -07:00
cmd/compile: fix noopt builder, weird append case
Turn off append-to-itself optimization if optimizations are turned off. This optimization triggered a bug when doing s = append(s, s) where we write to the leftmost s before reading the rightmost s. Update #17039 Change-Id: I21996532d20a75db6ec8d49db50cb157a1360b80 Reviewed-on: https://go-review.googlesource.com/81816 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
509ffb94ca
commit
9d70b3ae04
@ -737,7 +737,7 @@ func (s *state) stmt(n *Node) {
|
||||
// Check whether we're writing the result of an append back to the same slice.
|
||||
// If so, we handle it specially to avoid write barriers on the fast
|
||||
// (non-growth) path.
|
||||
if !samesafeexpr(n.Left, rhs.List.First()) {
|
||||
if !samesafeexpr(n.Left, rhs.List.First()) || Debug['N'] != 0 {
|
||||
break
|
||||
}
|
||||
// If the slice can be SSA'd, it'll be on the stack,
|
||||
|
Loading…
Reference in New Issue
Block a user