aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorJoe Soroka <gits@joesoroka.com>2011-04-08 00:44:01 -0700
committerJoe Soroka <gits@joesoroka.com>2011-04-08 00:44:01 -0700
commitb714af0405e70bba80395cddc4b02bc495d042bb (patch)
tree4c3354bb2d0ed656c03c7fa10de20089c4ac18e6 /tccgen.c
parent6eb97c70b70444185cdd46c859726a0af0fa2c87 (diff)
downloadtinycc-b714af0405e70bba80395cddc4b02bc495d042bb.tar.gz
tinycc-b714af0405e70bba80395cddc4b02bc495d042bb.tar.bz2
add naive workaround for VLA vstack leak
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index fd7ff25..67e9b8a 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -4342,11 +4342,14 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
gsym_addr(b, d);
} else if (tok == '{') {
Sym *llabel;
+ SValue *pvtop;
next();
/* record local declaration stack position */
s = local_stack;
llabel = local_label_stack;
+ /* record vstack position */
+ pvtop = vtop;
/* handle local labels declarations */
if (tok == TOK_LABEL) {
next();
@@ -4373,6 +4376,8 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
}
/* pop locally defined labels */
label_pop(&local_label_stack, llabel);
+ /* pop left-over VLA size expressions */
+ vtop = pvtop;
/* pop locally defined symbols */
if(is_expr) {
/* XXX: this solution makes only valgrind happy...