1
0
mirror of https://github.com/golang/go synced 2024-09-23 21:30:18 -06:00

nonaddressable = functioncall

code gen error

SVN=121541
This commit is contained in:
Ken Thompson 2008-06-06 16:49:35 -07:00
parent e92b753810
commit 6b8bd3556a
2 changed files with 26 additions and 2 deletions

View 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);

View 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);
}