Merge pull request #1401 from larsclausen/fix-bad-member-lval-proc-crash
Handle bogus member l-value paths
This commit is contained in:
commit
e9bc3488fb
|
|
@ -298,6 +298,15 @@ NetAssign_*PEIdent::elaborate_lval_var_(Design *des, NetScope *scope,
|
|||
// Past this point, we should have taken care of the cases
|
||||
// where the name is a member/method of a struct/class.
|
||||
// XXXX ivl_assert(*this, method_name.nil());
|
||||
if (!tail_path.empty()) {
|
||||
cerr << get_fileline() << ": error: Variable "
|
||||
<< reg->name()
|
||||
<< " does not have a field named: "
|
||||
<< tail_path << "." << endl;
|
||||
des->errors += 1;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ivl_assert(*this, tail_path.empty());
|
||||
|
||||
bool need_const_idx = is_cassign || is_force;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
// Check that bogus member access on procedural l-values reports an error.
|
||||
|
||||
module test;
|
||||
logic r;
|
||||
|
||||
initial begin
|
||||
r.bad = 1'b1;
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -256,6 +256,7 @@ sv_array_cassign10 vvp_tests/sv_array_cassign10.json
|
|||
sv_array_cassign_single vvp_tests/sv_array_cassign_single.json
|
||||
sv_array_cassign_single_fail1 vvp_tests/sv_array_cassign_single_fail1.json
|
||||
sv_automatic_2state vvp_tests/sv_automatic_2state.json
|
||||
sv_bad_member_lval_proc_fail vvp_tests/sv_bad_member_lval_proc_fail.json
|
||||
sv_byte_array_string1 vvp_tests/sv_byte_array_string1.json
|
||||
sv_byte_array_string2 vvp_tests/sv_byte_array_string2.json
|
||||
sv_byte_array_string3 vvp_tests/sv_byte_array_string3.json
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "CE",
|
||||
"source" : "sv_bad_member_lval_proc_fail.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
Loading…
Reference in New Issue