Compiler: Fix issue with multidimensional array variable release.

Imported from SM: https://bugs.alliedmods.net/show_bug.cgi?id=6100.
This commit is contained in:
Arkshine 2014-08-13 15:38:50 +02:00
parent 6978e2dc4c
commit 325a746d90
4 changed files with 15 additions and 2 deletions

View File

@ -130,6 +130,8 @@ class AMXXConfig(object):
'-Wno-uninitialized', '-Wno-uninitialized',
'-Wno-unused', '-Wno-unused',
'-Wno-switch', '-Wno-switch',
'-Wno-format',
'-Wno-format-security',
'-m32', '-m32',
] ]
cfg.cxxflags += [ cfg.cxxflags += [

View File

@ -513,6 +513,7 @@ SC_FUNC void delete_consttable(constvalue *table);
SC_FUNC symbol *add_constant(char *name,cell val,int vclass,int tag); SC_FUNC symbol *add_constant(char *name,cell val,int vclass,int tag);
SC_FUNC void exporttag(int tag); SC_FUNC void exporttag(int tag);
SC_FUNC void sc_attachdocumentation(symbol *sym); SC_FUNC void sc_attachdocumentation(symbol *sym);
SC_FUNC int get_actual_compound(symbol *sym);
/* function prototypes in SC2.C */ /* function prototypes in SC2.C */
#define PUSHSTK_P(v) { stkitem s_; s_.pv=(v); pushstk(s_); } #define PUSHSTK_P(v) { stkitem s_; s_.pv=(v); pushstk(s_); }

View File

@ -4282,7 +4282,7 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst)
int entry=FALSE; int entry=FALSE;
symbol *sym=root->next; symbol *sym=root->next;
while (sym!=NULL && sym->compound>=level) { while (sym != NULL && get_actual_compound(sym) >= level) {
switch (sym->ident) { switch (sym->ident) {
case iLABEL: case iLABEL:
if (testlabs) { if (testlabs) {

View File

@ -2417,6 +2417,16 @@ SC_FUNC void delete_symbol(symbol *root,symbol *sym)
free_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) SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_functions)
{ {
symbol *sym,*parent_sym; symbol *sym,*parent_sym;
@ -2427,7 +2437,7 @@ SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_
* specified nesting level */ * specified nesting level */
while (root->next!=NULL) { while (root->next!=NULL) {
sym=root->next; sym=root->next;
if (sym->compound<level) if (get_actual_compound(sym)<level)
break; break;
switch (sym->ident) { switch (sym->ident) {
case iLABEL: case iLABEL: