From 22cc6810733f8a7289c9b68e851185287bf384e5 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 15 Jan 2009 09:41:29 -0800 Subject: [PATCH] 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. --- vvp/parse.y | 4 ++-- vvp/vpi_scope.cc | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vvp/parse.y b/vvp/parse.y index bb8f5dd68..ee8228f5c 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -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. */ diff --git a/vvp/vpi_scope.cc b/vvp/vpi_scope.cc index 87eec4c6f..2875a1ce9 100644 --- a/vvp/vpi_scope.cc +++ b/vvp/vpi_scope.cc @@ -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;