Commit 3908c16f authored by Russ Cox's avatar Russ Cox

gc: bug265

Fixes #700.

R=ken2
CC=golang-dev
https://golang.org/cl/839041
parent b880543f
...@@ -328,6 +328,23 @@ samelist(NodeList *a, NodeList *b) ...@@ -328,6 +328,23 @@ samelist(NodeList *a, NodeList *b)
return a == b; return a == b;
} }
static int
paramoutheap(Node *fn)
{
NodeList *l;
for(l=fn->dcl; l; l=l->next) {
switch(l->n->class) {
case PPARAMOUT|PHEAP:
return 1;
case PAUTO:
case PAUTO|PHEAP:
// stop early - parameters are over
return 0;
}
}
return 0;
}
void void
walkstmt(Node **np) walkstmt(Node **np)
...@@ -441,11 +458,9 @@ walkstmt(Node **np) ...@@ -441,11 +458,9 @@ walkstmt(Node **np)
case ORETURN: case ORETURN:
walkexprlist(n->list, &n->ninit); walkexprlist(n->list, &n->ninit);
if(curfn->type->outnamed && count(n->list) != 1) { if(n->list == nil)
if(n->list == nil) {
// print("special return\n");
break; break;
} if((curfn->type->outnamed && count(n->list) > 1) || paramoutheap(curfn)) {
// assign to the function out parameters, // assign to the function out parameters,
// so that reorder3 can fix up conflicts // so that reorder3 can fix up conflicts
rl = nil; rl = nil;
......
...@@ -192,6 +192,3 @@ bal ...@@ -192,6 +192,3 @@ bal
barCount != 1 barCount != 1
panic PC=xxx panic PC=xxx
BUG BUG
=========== bugs/bug265.go
BUG
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