From 445208086121ea343bdb80a9998637361c841bea Mon Sep 17 00:00:00 2001 From: Zachary Snow Date: Mon, 10 May 2021 11:06:02 -0400 Subject: [PATCH] sv: check validity of package end label --- frontends/verilog/verilog_parser.y | 2 ++ tests/verilog/package_end_label.ys | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/verilog/package_end_label.ys diff --git a/frontends/verilog/verilog_parser.y b/frontends/verilog/verilog_parser.y index e4b3258c2..dd25f412f 100644 --- a/frontends/verilog/verilog_parser.y +++ b/frontends/verilog/verilog_parser.y @@ -579,6 +579,8 @@ package: append_attr(mod, $1); } ';' package_body TOK_ENDPACKAGE opt_label { ast_stack.pop_back(); + if ($4 != NULL && $9 != NULL && *$4 != *$9) + frontend_verilog_yyerror("Package name (%s) and end label (%s) don't match.", $4->c_str()+1, $9->c_str()+1); current_ast_mod = NULL; exitTypeScope(); }; diff --git a/tests/verilog/package_end_label.ys b/tests/verilog/package_end_label.ys new file mode 100644 index 000000000..ccc5c96e9 --- /dev/null +++ b/tests/verilog/package_end_label.ys @@ -0,0 +1,15 @@ +logger -expect-no-warnings +read_verilog -sv <