Fix compiler bug with multidimensional array variable release (bug 6100, r=fyren).

--HG--
extra : rebase_source : 3f3c366fd8c47268ecd0df5907b68d3c879a5e60
This commit is contained in:
David Anderson 2014-05-09 23:17:14 -04:00
parent e9b4a6e96c
commit 29ff05bd62
4 changed files with 15 additions and 2 deletions

View File

@ -142,6 +142,8 @@ class SMConfig(object):
'-Wno-uninitialized',
'-Wno-unused',
'-Wno-switch',
'-Wno-format',
'-Wno-format-security',
'-msse',
'-m32',
]

View File

@ -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_); }

View File

@ -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;

View File

@ -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->compound<level)
if (get_actual_compound(sym)<level)
break;
switch (sym->ident) {
case iLABEL: