diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 4372cd44..b9e4ed34 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -4041,7 +4041,7 @@ static int newfunc(char *firstname,int firsttag,int fpublic,int fstatic,int stoc * has only a single statement in its body (no compound block) and that * statement declares a new variable */ - popstacklist(); + popstacklist(1); declared=0; } /* if */ if ((lastst!=tRETURN) && (lastst!=tGOTO)){ @@ -5503,8 +5503,11 @@ static void compound(int stmt_sameline,int starttok) if (lastst!=tRETURN) destructsymbols(&loctab,nestlevel); if (lastst!=tRETURN && lastst!=tGOTO) { - popheaplist(); - popstacklist(); + popheaplist(1); + popstacklist(1); + } else { + popheaplist(0); + popstacklist(0); } testsymbols(&loctab,nestlevel,FALSE,TRUE); /* look for unused block locals */ declared=save_decl; @@ -5845,7 +5848,7 @@ static int dofor(void) * variable in "expr1". */ destructsymbols(&loctab,nestlevel); - popstacklist(); + popstacklist(1); testsymbols(&loctab,nestlevel,FALSE,TRUE); /* look for unused block locals */ declared=save_decl; delete_symbols(&loctab,nestlevel,FALSE,TRUE); diff --git a/sourcepawn/compiler/sctracker.c b/sourcepawn/compiler/sctracker.c index 5c5693f6..b3bbc1a9 100644 --- a/sourcepawn/compiler/sctracker.c +++ b/sourcepawn/compiler/sctracker.c @@ -402,12 +402,15 @@ void genheapfree(int stop_id) } } -void popstacklist() +void popstacklist(int codegen) { memuse_list_t *oldlist; assert(stackusage != NULL); - _stack_genusage(stackusage, 1); + if (codegen) + { + _stack_genusage(stackusage, 1); + } assert(stackusage->head==NULL); oldlist = stackusage->prev; diff --git a/sourcepawn/compiler/sctracker.h b/sourcepawn/compiler/sctracker.h index ed4576bf..1aecdc09 100644 --- a/sourcepawn/compiler/sctracker.h +++ b/sourcepawn/compiler/sctracker.h @@ -95,7 +95,7 @@ int markheap(int type, int size); * Stack functions */ void pushstacklist(); -void popstacklist(); +void popstacklist(int codegen); int markstack(int type, int size); /** * Generates code to free mem usage, but does not pop the list.