Commit d015f896 authored by Ken Thompson's avatar Ken Thompson

clear output parameters

R=r
OCL=16345
CL=16345
parent 5e92fb20
......@@ -20,6 +20,7 @@ compile(Node *fn)
Node nod1;
Prog *ptxt;
int32 lno;
Type *t;
if(newproc == N) {
newproc = nod(ONAME, N, N);
......@@ -56,6 +57,17 @@ if(throwreturn == N) {
curfn = fn;
dowidth(curfn->type);
if(curfn->type->outnamed) {
// add clearing of the output parameters
t = structfirst(&pl, getoutarg(curfn->type));
while(t != T) {
if(t->nname != N && t->nname->sym->name[0] != '_') {
curfn->nbody = list(nod(OAS, t->nname, N), curfn->nbody);
}
t = structnext(&pl);
}
}
walk(curfn);
if(nerrors != 0)
goto ret;
......
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