Skip to content

Commit b3378f5

Browse files
committed
Fixed number of function results at an earlier point, to reduce warnings
1 parent 5cb3b02 commit b3378f5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

frontends/hltransform.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,24 @@ doSimplifyAssignments(AST **astptr, int insertCasts, int atTopLevel)
476476
}
477477
}
478478

479+
/////////////////////////////////////////////////////////////////////////
480+
// high level transforms common to most languages
479481
/////////////////////////////////////////////////////////////////////////
480482
void
481483
DoHLTransforms(Function *F)
482484
{
483485
Function *savecurrent = curfunc;
484486
curfunc = F;
487+
// correct the function's numresults
488+
AST *functype;
489+
functype = F->overalltype;
490+
if (functype) {
491+
int n = FuncNumResults(functype);
492+
if (F->numresults != n) {
493+
F->numresults = n;
494+
}
495+
}
496+
// simplify assignments within the function
485497
int insertCasts = !IsSpinLang(F->language);
486498
doSimplifyAssignments(&F->body, insertCasts, 1);
487499
curfunc = savecurrent;

0 commit comments

Comments
 (0)