Fix compiler bug with multidimensional array variable release (bug 6100, r=fyren).
Fix compiler bug with multidimensional array variable release (
bug 6100, r=fyren).
1.1 --- a/AMBuildScript Fri May 09 12:32:49 2014 -0700
1.2 +++ b/AMBuildScript Fri May 09 23:17:14 2014 -0400
1.3 @@ -142,6 +142,8 @@
1.4 '-Wno-uninitialized',
1.5 '-Wno-unused',
1.6 '-Wno-switch',
1.7 + '-Wno-format',
1.8 + '-Wno-format-security',
1.9 '-msse',
1.10 '-m32',
1.11 ]
2.1 --- a/sourcepawn/compiler/sc.h Fri May 09 12:32:49 2014 -0700
2.2 +++ b/sourcepawn/compiler/sc.h Fri May 09 23:17:14 2014 -0400
2.3 @@ -538,6 +538,7 @@
2.4 SC_FUNC void exporttag(int tag);
2.5 SC_FUNC void sc_attachdocumentation(symbol *sym);
2.6 SC_FUNC constvalue *find_tag_byval(int tag);
2.7 +SC_FUNC int get_actual_compound(symbol *sym);
2.8
2.9 /* function prototypes in SC2.C */
2.10 #define PUSHSTK_P(v) { stkitem s_; s_.pv=(v); pushstk(s_); }
3.1 --- a/sourcepawn/compiler/sc1.c Fri May 09 12:32:49 2014 -0700
3.2 +++ b/sourcepawn/compiler/sc1.c Fri May 09 23:17:14 2014 -0400
3.3 @@ -5417,7 +5417,7 @@
3.4 cell offset=0;
3.5 int savepri=FALSE;
3.6 symbol *sym=root->next;
3.7 - while (sym!=NULL && sym->compound>=level) {
3.8 + while (sym!=NULL && get_actual_compound(sym)>=level) {
3.9 if (sym->ident==iVARIABLE || sym->ident==iARRAY) {
3.10 char symbolname[16];
3.11 symbol *opsym;
4.1 --- a/sourcepawn/compiler/sc2.c Fri May 09 12:32:49 2014 -0700
4.2 +++ b/sourcepawn/compiler/sc2.c Fri May 09 23:17:14 2014 -0400
4.3 @@ -2461,6 +2461,16 @@
4.4 free_symbol(sym);
4.5 }
4.6
4.7 +SC_FUNC int get_actual_compound(symbol *sym)
4.8 +{
4.9 + if (sym->ident == iARRAY || sym->ident == iREFARRAY) {
4.10 + while (sym->parent)
4.11 + sym = sym->parent;
4.12 + }
4.13 +
4.14 + return sym->compound;
4.15 +}
4.16 +
4.17 SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_functions)
4.18 {
4.19 symbol *origRoot=root;
4.20 @@ -2472,7 +2482,7 @@
4.21 * specified nesting level */
4.22 while (root->next!=NULL) {
4.23 sym=root->next;
4.24 - if (sym->compound<level)
4.25 + if (get_actual_compound(sym)<level)
4.26 break;
4.27 switch (sym->ident) {
4.28 case iLABEL: