Handle old style scope declarations correctly.

I forgot to modify the old style scope declarations so the
code was trying to free a constant string. Found in the vvp
test examples/hello.vvp.
This commit is contained in:
Cary R 2009-01-15 09:41:29 -08:00 committed by Stephen Williams
parent 8c07d3b51c
commit 22cc681073
2 changed files with 4 additions and 3 deletions

View File

@ -583,10 +583,10 @@ statement
/* XXXX Legacy declaration has no type name. */
| T_LABEL K_SCOPE T_SYMBOL ',' T_STRING ';'
{ compile_scope_decl($1, $3, $5, "", 0, 0, 0, 0, 0); }
{ compile_scope_decl($1, $3, $5, 0, 0, 0, 0, 0, 0); }
| T_LABEL K_SCOPE T_SYMBOL ',' T_STRING ',' T_SYMBOL ';'
{ compile_scope_decl($1, $3, $5, "", $7, 0, 0, 0, 0); }
{ compile_scope_decl($1, $3, $5, 0, $7, 0, 0, 0, 0); }
/* Scope recall has no label of its own, but refers by label to a
declared scope. */

View File

@ -362,7 +362,8 @@ compile_scope_decl(char*label, char*type, char*name, char*tname,
assert(scope->base.vpi_type);
scope->name = vpip_name_string(name);
scope->tname = vpip_name_string(tname);
if (tname) scope->tname = vpip_name_string(tname);
else scope->tname = vpip_name_string("");
scope->file_idx = (unsigned) file_idx;
scope->lineno = (unsigned) lineno;
scope->def_file_idx = (unsigned) def_file_idx;