Commit 8883c484 authored by Dave Cheney's avatar Dave Cheney

cmd/gc: silence valgrind error

valgrind complained that under some circumstances,

    *nr = *nc

was being called when nr and nc were the same *Node. The suggestion my Rémy was to introduce a tmp node to avoid the potential for aliasing in subnode.

R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7780044
parent 4e63d6ee
...@@ -36,7 +36,7 @@ void ...@@ -36,7 +36,7 @@ void
complexmove(Node *f, Node *t) complexmove(Node *f, Node *t)
{ {
int ft, tt; int ft, tt;
Node n1, n2, n3, n4; Node n1, n2, n3, n4, tmp;
if(debug['g']) { if(debug['g']) {
dump("\ncomplexmove-f", f); dump("\ncomplexmove-f", f);
...@@ -62,9 +62,9 @@ complexmove(Node *f, Node *t) ...@@ -62,9 +62,9 @@ complexmove(Node *f, Node *t)
// make f addable. // make f addable.
// also use temporary if possible stack overlap. // also use temporary if possible stack overlap.
if(!f->addable || overlap(f, t)) { if(!f->addable || overlap(f, t)) {
tempname(&n1, f->type); tempname(&tmp, f->type);
complexmove(f, &n1); complexmove(f, &tmp);
f = &n1; f = &tmp;
} }
subnode(&n1, &n2, f); subnode(&n1, &n2, f);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment