From 29ff05bd62813e0b2b86f023a9c2c3f03db67aac Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 9 May 2014 23:17:14 -0400 Subject: [PATCH] Fix compiler bug with multidimensional array variable release (bug 6100, r=fyren). --HG-- extra : rebase_source : 3f3c366fd8c47268ecd0df5907b68d3c879a5e60 --- AMBuildScript | 2 ++ sourcepawn/compiler/sc.h | 1 + sourcepawn/compiler/sc1.c | 2 +- sourcepawn/compiler/sc2.c | 12 +++++++++++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/AMBuildScript b/AMBuildScript index e693cff9..8a25a9e5 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -142,6 +142,8 @@ class SMConfig(object): '-Wno-uninitialized', '-Wno-unused', '-Wno-switch', + '-Wno-format', + '-Wno-format-security', '-msse', '-m32', ] diff --git a/sourcepawn/compiler/sc.h b/sourcepawn/compiler/sc.h index 20ea5b62..27ea591e 100644 --- a/sourcepawn/compiler/sc.h +++ b/sourcepawn/compiler/sc.h @@ -538,6 +538,7 @@ SC_FUNC symbol *add_constant(char *name,cell val,int vclass,int tag); SC_FUNC void exporttag(int tag); SC_FUNC void sc_attachdocumentation(symbol *sym); SC_FUNC constvalue *find_tag_byval(int tag); +SC_FUNC int get_actual_compound(symbol *sym); /* function prototypes in SC2.C */ #define PUSHSTK_P(v) { stkitem s_; s_.pv=(v); pushstk(s_); } diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 8e0a6385..717a9e25 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -5417,7 +5417,7 @@ static void destructsymbols(symbol *root,int level) cell offset=0; int savepri=FALSE; symbol *sym=root->next; - while (sym!=NULL && sym->compound>=level) { + while (sym!=NULL && get_actual_compound(sym)>=level) { if (sym->ident==iVARIABLE || sym->ident==iARRAY) { char symbolname[16]; symbol *opsym; diff --git a/sourcepawn/compiler/sc2.c b/sourcepawn/compiler/sc2.c index f7bb3d2c..312eeafd 100644 --- a/sourcepawn/compiler/sc2.c +++ b/sourcepawn/compiler/sc2.c @@ -2461,6 +2461,16 @@ SC_FUNC void delete_symbol(symbol *root,symbol *sym) free_symbol(sym); } +SC_FUNC int get_actual_compound(symbol *sym) +{ + if (sym->ident == iARRAY || sym->ident == iREFARRAY) { + while (sym->parent) + sym = sym->parent; + } + + return sym->compound; +} + SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_functions) { symbol *origRoot=root; @@ -2472,7 +2482,7 @@ SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_ * specified nesting level */ while (root->next!=NULL) { sym=root->next; - if (sym->compoundident) { case iLABEL: