]> Cypherpunks repositories - gostls13.git/commitdiff
fix bug 275
authorKen Thompson <ken@golang.org>
Fri, 21 May 2010 03:56:28 +0000 (20:56 -0700)
committerKen Thompson <ken@golang.org>
Fri, 21 May 2010 03:56:28 +0000 (20:56 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/1198046

src/cmd/gc/cplx.c
test/golden.out

index a98cf49d8d8b2572170ef4caed67d485ae2ac5c1..7da61c24711959e90dc03ab4b1cff69ad3a78d21 100644 (file)
@@ -129,12 +129,18 @@ complexgen(Node *n, Node *res)
                return;
 
        case OREAL:
-               subnode(&n1, &n2, n->left);
-               cgen(&n1, res);
-               return;
-
        case OIMAG:
-               subnode(&n1, &n2, n->left);
+               nl = n->left;
+               if(!nl->addable) {
+                       tempname(&tmp, nl->type);
+                       complexgen(nl, &tmp);
+                       nl = &tmp;
+               }
+               subnode(&n1, &n2, nl);
+               if(n->op == OREAL) {
+                       cgen(&n1, res);
+                       return;
+               }
                cgen(&n2, res);
                return;
        }
index 22f2f98a6149b6444692d5ab10c3b694b822d837..1bed6599a8d27bb8726e78d03c8984bef1bfd9da 100644 (file)
@@ -180,7 +180,3 @@ BUG: bug260 failed
 
 =========== bugs/bug274.go
 BUG: errchk: command succeeded unexpectedly
-
-=========== bugs/bug275.go
-bugs/bug275.go:17: internal compiler error: subnode not addable
-BUG should compile