Index: src/cmd/5g/cgen.c |
=================================================================== |
--- a/src/cmd/5g/cgen.c |
+++ b/src/cmd/5g/cgen.c |
@@ -604,6 +604,7 @@ |
// The generated code is just going to panic, so it need not |
// be terribly efficient. See issue 3670. |
tempname(&n1, n->type); |
+ gvardef(&n1); |
clearfat(&n1); |
regalloc(&n2, types[tptr], res); |
gins(AMOVW, &n1, &n2); |
@@ -1440,10 +1441,6 @@ |
return; |
} |
- // Record site of definition of ns for liveness analysis. |
- if(res->op == ONAME && res->class != PEXTERN) |
- gvardef(res); |
- |
// If copying .args, that's all the results, so record definition sites |
// for them for the liveness analysis. |
if(res->op == ONAME && strcmp(res->sym->name, ".args") == 0) |
@@ -1502,8 +1499,12 @@ |
agenr(n, &dst, res); // temporarily use dst |
regalloc(&src, types[tptr], N); |
gins(AMOVW, &dst, &src); |
+ if(res->op == ONAME) |
+ gvardef(res); |
agen(res, &dst); |
} else { |
+ if(res->op == ONAME) |
+ gvardef(res); |
agenr(res, &dst, res); |
agenr(n, &src, N); |
} |
@@ -1638,6 +1639,8 @@ |
switch(nl->type->etype) { |
case TARRAY: |
+ if(nl->op == ONAME) |
+ gvardef(nl); |
nodl.xoffset += Array_array; |
nodl.type = ptrto(nl->type->type); |
@@ -1668,6 +1671,8 @@ |
goto yes; |
case TSTRING: |
+ if(nl->op == ONAME) |
+ gvardef(nl); |
nodl.xoffset += Array_array; |
nodl.type = ptrto(types[TUINT8]); |
@@ -1689,6 +1694,8 @@ |
goto yes; |
case TINTER: |
+ if(nl->op == ONAME) |
+ gvardef(nl); |
nodl.xoffset += Array_array; |
nodl.type = ptrto(types[TUINT8]); |