From 3f875f72f08d631060ef6dc559ada78fe267e570 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 27 Jun 2026 09:40:05 -0700 Subject: [PATCH] Add regression tests for procedural labels shadowing type identifiers Check that a visible type identifier can be reused as a procedural assertion label after a declaration in both task and block bodies. These are the contexts where label and declaration parsing meet. Also check that a null statement ends the declaration portion of a procedural body and a following declaration is rejected. Signed-off-by: Lars-Peter Clausen --- ...sv_declaration_after_null_statement_fail.v | 10 +++++++++ .../sv_type_identifier_assert_label.v | 22 +++++++++++++++++++ ivtest/regress-vvp.list | 2 ++ ...declaration_after_null_statement_fail.json | 5 +++++ .../sv_type_identifier_assert_label.json | 5 +++++ 5 files changed, 44 insertions(+) create mode 100644 ivtest/ivltests/sv_declaration_after_null_statement_fail.v create mode 100644 ivtest/ivltests/sv_type_identifier_assert_label.v create mode 100644 ivtest/vvp_tests/sv_declaration_after_null_statement_fail.json create mode 100644 ivtest/vvp_tests/sv_type_identifier_assert_label.json diff --git a/ivtest/ivltests/sv_declaration_after_null_statement_fail.v b/ivtest/ivltests/sv_declaration_after_null_statement_fail.v new file mode 100644 index 000000000..627ab845c --- /dev/null +++ b/ivtest/ivltests/sv_declaration_after_null_statement_fail.v @@ -0,0 +1,10 @@ +// Check that a declaration after a null statement is rejected. + +module test; + + initial begin + ; + integer value; + end + +endmodule diff --git a/ivtest/ivltests/sv_type_identifier_assert_label.v b/ivtest/ivltests/sv_type_identifier_assert_label.v new file mode 100644 index 000000000..6d566f889 --- /dev/null +++ b/ivtest/ivltests/sv_type_identifier_assert_label.v @@ -0,0 +1,22 @@ +// Check that assertion labels can shadow type identifiers after declarations. + +typedef reg [7:0] CHECK; + +module test; + + task check_task; + CHECK value; + CHECK: assert (1); + endtask + + initial begin + begin + CHECK value; + CHECK: assert (1); + end + + check_task; + $display("PASSED"); + end + +endmodule diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index c0263f055..29d877666 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -309,6 +309,7 @@ sv_const_fail8 vvp_tests/sv_const_fail8.json sv_const_fail9 vvp_tests/sv_const_fail9.json sv_darray_assign_op vvp_tests/sv_darray_assign_op.json sv_darray_find_locators vvp_tests/sv_darray_find_locators.json +sv_declaration_after_null_statement_fail vvp_tests/sv_declaration_after_null_statement_fail.json sv_default_port_value1 vvp_tests/sv_default_port_value1.json sv_default_port_value2 vvp_tests/sv_default_port_value2.json sv_default_port_value3 vvp_tests/sv_default_port_value3.json @@ -406,6 +407,7 @@ sv_soft_packed_union_fail1 vvp_tests/sv_soft_packed_union_fail1.json sv_string_method_substr_too_few_arg_fail vvp_tests/sv_string_method_substr_too_few_arg_fail.json sv_super_member_fail vvp_tests/sv_super_member_fail.json sv_type_identifier_ams_name_fields vvp_tests/sv_type_identifier_ams_name_fields.json +sv_type_identifier_assert_label vvp_tests/sv_type_identifier_assert_label.json sv_type_identifier_attribute_name vvp_tests/sv_type_identifier_attribute_name.json sv_type_identifier_attribute_target vvp_tests/sv_type_identifier_attribute_target.json sv_type_identifier_block_label_name vvp_tests/sv_type_identifier_block_label_name.json diff --git a/ivtest/vvp_tests/sv_declaration_after_null_statement_fail.json b/ivtest/vvp_tests/sv_declaration_after_null_statement_fail.json new file mode 100644 index 000000000..ccfcdfeeb --- /dev/null +++ b/ivtest/vvp_tests/sv_declaration_after_null_statement_fail.json @@ -0,0 +1,5 @@ +{ + "type" : "CE", + "source" : "sv_declaration_after_null_statement_fail.v", + "iverilog-args" : [ "-g2005-sv" ] +} diff --git a/ivtest/vvp_tests/sv_type_identifier_assert_label.json b/ivtest/vvp_tests/sv_type_identifier_assert_label.json new file mode 100644 index 000000000..e849f5ea0 --- /dev/null +++ b/ivtest/vvp_tests/sv_type_identifier_assert_label.json @@ -0,0 +1,5 @@ +{ + "type" : "normal", + "source" : "sv_type_identifier_assert_label.v", + "iverilog-args" : [ "-g2005-sv" ] +}