diff --git a/ivtest/gold/br_gh1182.gold b/ivtest/gold/br_gh1182.gold new file mode 100644 index 000000000..3b1b64ace --- /dev/null +++ b/ivtest/gold/br_gh1182.gold @@ -0,0 +1,3 @@ +./ivltests/br_gh1182.v:3: error: Variable declaration in unnamed block requires SystemVerilog. +./ivltests/br_gh1182.v:4: error: Variable declaration in unnamed block requires SystemVerilog. +./ivltests/br_gh1182.v:8: error: Variable declaration in unnamed block requires SystemVerilog. diff --git a/ivtest/ivltests/br_gh1182.v b/ivtest/ivltests/br_gh1182.v new file mode 100644 index 000000000..13fe64346 --- /dev/null +++ b/ivtest/ivltests/br_gh1182.v @@ -0,0 +1,11 @@ +module top; + initial begin + logic [7:0] data; + logic [3:0] tmp; + end + + initial begin + logic [3:0] nib; + $display("PASSED"); + end +endmodule diff --git a/ivtest/regress-fsv.list b/ivtest/regress-fsv.list index 38c0db645..55de4b8a6 100644 --- a/ivtest/regress-fsv.list +++ b/ivtest/regress-fsv.list @@ -74,6 +74,7 @@ br1027e normal ivltests gold=br1027e-fsv.gold br_gh25a normal ivltests br_gh25b normal ivltests br_gh567 normal ivltests +br_gh1182 normal ivltests check_constant_3 normal ivltests function4 normal ivltests module_inout_port_type normal ivltests diff --git a/ivtest/regress-vlg.list b/ivtest/regress-vlg.list index 4a6475b9d..f943bfabd 100644 --- a/ivtest/regress-vlg.list +++ b/ivtest/regress-vlg.list @@ -363,6 +363,7 @@ br_gh1175f CE ivltests gold=br_gh1175f.gold br_gh1178a CE ivltests gold=br_gh1178a.gold br_gh1178b normal ivltests br_gh1178c normal ivltests +br_gh1182 CE ivltests gold=br_gh1182.gold br_ml20150315 normal ivltests gold=br_ml_20150315.gold br_ml20150321 CE ivltests br_mw20171108 normal ivltests diff --git a/parse.y b/parse.y index 9712f76b1..e0e6c866f 100644 --- a/parse.y +++ b/parse.y @@ -6708,7 +6708,7 @@ statement_item /* This is roughly statement_item in the LRM */ { if (!$2) { if ($4) { - pform_requires_sv(@4, "Variable declaration in unnamed block"); + pform_block_decls_requires_sv(); } else { /* If there are no declarations in the scope then just delete it. */ pform_pop_scope(); diff --git a/pform.cc b/pform.cc index 9322288f3..9230cd42b 100644 --- a/pform.cc +++ b/pform.cc @@ -3364,6 +3364,16 @@ bool pform_requires_sv(const struct vlltype&loc, const char *feature) return false; } +void pform_block_decls_requires_sv(void) +{ + for (auto const& wire : lexical_scope->wires) { + struct vlltype loc; + loc.text = wire.second->get_file(); + loc.first_line = wire.second->get_lineno(); + pform_requires_sv(loc, "Variable declaration in unnamed block"); + } +} + void pform_check_net_data_type(const struct vlltype&loc, NetNet::Type net_type, const data_type_t *data_type) { diff --git a/pform.h b/pform.h index 64e23972b..d1335d8c5 100644 --- a/pform.h +++ b/pform.h @@ -583,6 +583,7 @@ extern bool allow_timeprec_decl; void pform_put_enum_type_in_scope(enum_type_t*enum_set); bool pform_requires_sv(const struct vlltype&loc, const char *feature); +void pform_block_decls_requires_sv(void); void pform_start_parameter_port_list(); void pform_end_parameter_port_list();