Handle invalid l-value indexed part select bases
The l-value indexed part select path elaborates the base expression with `elab_and_eval()`. If the base expression can not be bound this returns a nullptr, but the l-value path dereferenced it while checking the expression type. For example, `a[does_not_exist -: 2] = 2'b00;` reported the bind error and then crashed. Return early when base elaboration fails. This matches the r-value indexed part select path and leaves the existing bind error as the reported elaboration error. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
4e168a4d1f
commit
9004d10df4
|
|
@ -883,8 +883,10 @@ bool PEIdent::elaborate_lval_net_idx_(Design*des,
|
|||
calculate_up_do_width_(des, scope, wid);
|
||||
|
||||
NetExpr*base = elab_and_eval(des, scope, index_tail.msb, -1);
|
||||
if (!base)
|
||||
return false;
|
||||
|
||||
if (base && base->expr_type() == IVL_VT_REAL) {
|
||||
if (base->expr_type() == IVL_VT_REAL) {
|
||||
cerr << get_fileline() << ": error: Indexed part select base "
|
||||
"expression for ";
|
||||
cerr << lv->sig()->name() << "[" << *base;
|
||||
|
|
|
|||
Loading…
Reference in New Issue