mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/gc: fix mayAffectMemory in esc.go
For OINDEX and other Left+Right nodes, we want the whole node to be considered as "may affect memory" if either of Left or Right affect memory. Initial implementation only considered node as such if both Left and Right were non-safe. Change-Id: Icfb965a0b4c24d8f83f3722216db068dad2eba95 Reviewed-on: https://go-review.googlesource.com/133275 Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
3fd364988c
commit
4cf33e361a
2 changed files with 10 additions and 2 deletions
|
|
@ -696,9 +696,9 @@ func (e *EscState) mayAffectMemory(n *Node) bool {
|
|||
case OCONV:
|
||||
return e.mayAffectMemory(n.Left)
|
||||
case OINDEX:
|
||||
return e.mayAffectMemory(n.Left) && e.mayAffectMemory(n.Right)
|
||||
return e.mayAffectMemory(n.Left) || e.mayAffectMemory(n.Right)
|
||||
case OADD, OSUB, OOR, OXOR, OMUL, OLSH, ORSH, OAND, OANDNOT, ODIV, OMOD:
|
||||
return e.mayAffectMemory(n.Left) && e.mayAffectMemory(n.Right)
|
||||
return e.mayAffectMemory(n.Left) || e.mayAffectMemory(n.Right)
|
||||
case ONOT, OCOM, OPLUS, OMINUS, OALIGNOF, OOFFSETOF, OSIZEOF:
|
||||
return e.mayAffectMemory(n.Left)
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue