]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: silence valgrind error
authorDave Cheney <dave@cheney.net>
Wed, 13 Mar 2013 20:12:38 +0000 (16:12 -0400)
committerDave Cheney <dave@cheney.net>
Wed, 13 Mar 2013 20:12:38 +0000 (16:12 -0400)
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

src/cmd/gc/cplx.c

index e0127fc59ae6499ccb23cf37674c12845c9e4a99..c9bab7a7686c69e20ed025dfc731b6677b2c4b5f 100644 (file)
@@ -36,7 +36,7 @@ void
 complexmove(Node *f, Node *t)
 {
        int ft, tt;
-       Node n1, n2, n3, n4;
+       Node n1, n2, n3, n4, tmp;
 
        if(debug['g']) {
                dump("\ncomplexmove-f", f);
@@ -62,9 +62,9 @@ complexmove(Node *f, Node *t)
                // make f addable.
                // also use temporary if possible stack overlap.
                if(!f->addable || overlap(f, t)) {
-                       tempname(&n1, f->type);
-                       complexmove(f, &n1);
-                       f = &n1;
+                       tempname(&tmp, f->type);
+                       complexmove(f, &tmp);
+                       f = &tmp;
                }
 
                subnode(&n1, &n2, f);