Don't crash if parameter/localparam defined from constant user function.
This patch avoids a crash when trying to use a parameter/localparam that
has been assigned a value from a constant user function. Icarus does not
currently support constant user functions so it creates a parameter with
a NULL value. This patch fixes a few places where this could crash the
compiler.
(cherry picked from commit 3f203c4363)
This commit is contained in:
parent
597c3da220
commit
e11f4cf69e
|
|
@ -508,7 +508,7 @@ void NetEParam::resolve_pexpr_type(void)
|
||||||
if (reference_->second.signed_flag) {
|
if (reference_->second.signed_flag) {
|
||||||
cast_signed_base_(true);
|
cast_signed_base_(true);
|
||||||
|
|
||||||
} else {
|
} else if (reference_->second.expr) {
|
||||||
cast_signed_base_( reference_->second.expr->has_sign() );
|
cast_signed_base_( reference_->second.expr->has_sign() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
eval_tree.cc
10
eval_tree.cc
|
|
@ -1231,7 +1231,15 @@ NetExpr* NetEParam::eval_tree(int prune_to_width)
|
||||||
assert(scope_);
|
assert(scope_);
|
||||||
perm_string name = (*reference_).first;
|
perm_string name = (*reference_).first;
|
||||||
const NetExpr*expr = (*reference_).second.expr;
|
const NetExpr*expr = (*reference_).second.expr;
|
||||||
ivl_assert(*this, expr);
|
// Since constant user functions are not supported we can get
|
||||||
|
// parameters/localparams that are not defined. For now generate
|
||||||
|
// an appropriate error message.
|
||||||
|
if (expr == NULL) {
|
||||||
|
cerr << get_fileline() << ": internal error: parameter/localparam "
|
||||||
|
<< *this << " cannot be evaluated." << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// ivl_assert(*this, expr);
|
||||||
|
|
||||||
NetExpr*nexpr = expr->dup_expr();
|
NetExpr*nexpr = expr->dup_expr();
|
||||||
assert(nexpr);
|
assert(nexpr);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue