aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--awkgram.y2
-rw-r--r--symbol.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/awkgram.y b/awkgram.y
index 423cf66b..4f568e22 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -5208,7 +5208,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
/* update lint table info */
func_use(thisfunc->vname, FUNC_DEFINE);
- /* remove params/locals from symbol table */
+ /* remove params from symbol table */
remove_locals(thisfunc);
return fi;
}
diff --git a/symbol.c b/symbol.c
index afa38f1b..9f40568a 100644
--- a/symbol.c
+++ b/symbol.c
@@ -266,7 +266,10 @@ remove_locals(NODE *func)
assert(func->type == Node_func);
- if ( (pcount = func->frame_cnt) <= 0
+ /* Only remove up to param_cnt. The @let locals from param_cnt to frame_cnt
+ * should have already been removed by the parser.
+ */
+ if ( (pcount = func->param_cnt) <= 0
|| (parms = func->fparms) == NULL)
return;