]> Cypherpunks repositories - gostls13.git/commitdiff
nonaddressable = functioncall
authorKen Thompson <ken@golang.org>
Fri, 6 Jun 2008 23:49:35 +0000 (16:49 -0700)
committerKen Thompson <ken@golang.org>
Fri, 6 Jun 2008 23:49:35 +0000 (16:49 -0700)
code gen error

SVN=121541

src/cmd/6g/cgen.c
src/cmd/6g/gen.c

index 7a006883924c7c846b31af115165a73f3dbfcc22..531f0614b16aaf73eaab2c77926811c8f201f71c 100644 (file)
@@ -22,6 +22,13 @@ cgen(Node *n, Node *res)
        if(res == N || res->type == T)
                fatal("cgen: res nil");
 
+       if(n->ullman >= UINF) {
+               if(n->op == OINDREG)
+                       fatal("cgen: this is going to misscompile");
+               if(res->ullman >= UINF)
+                       fatal("cgen: fun both sides");
+       }
+
        lno = dynlineno;
        if(n->op != ONAME)
                dynlineno = n->lineno;  // for diagnostics
@@ -32,6 +39,14 @@ cgen(Node *n, Node *res)
        }
 
        if(!res->addable) {
+               if(n->ullman > res->ullman) {
+                       regalloc(&n1, nr->type, res);
+                       cgen(n, &n1);
+                       cgen(&n1, res);
+                       regfree(&n1);
+                       return;
+               }
+
                igen(res, &n1, N);
                cgen(n, &n1);
                regfree(&n1);
index 4f4c4d122cebc1a3db3f72b62cda37a4260f912b..47e503764075907b5e8e8756d99904a7562d5bd4 100644 (file)
@@ -688,10 +688,15 @@ cgen_asop(Node *nl, Node *nr, int op)
        Node n1, n2;
        int a;
 
-       // botch compare ullman numbers
-       // and use temp for functions
+       if(nr->ullman >= UINF && nl->ullman >= UINF) {
+               fatal("cgen_asop both sides call");
+       }
 
        a = optoas(op, nl->type);
+       if(nr->ullman > nl->ullman) {
+               fatal("gcgen_asopen");
+       }
+
        regalloc(&n1, nl->type, N);
        if(nl->addable) {
                cgen(nr, &n1);
@@ -815,5 +820,9 @@ cgen_as(Node *nl, Node *nr, int op)
                nr->addable = 1;
                ullmancalc(nr);
        }
+
+       if(nr->ullman >= UINF && nl->ullman >= UINF) {
+               fatal("cgen_as both sides call");
+       }
        cgen(nr, nl);
 }