Fix for crash when real value assigned to signed type parameter.
A declaration of the form "parameter signed a = 1.0" causes a compiler crash. The standard is somewhat contradictory on what type "a" should have, but testing with other compilers shows a majority in favour of it being a real value.
This commit is contained in:
parent
670efb38d9
commit
831b6d3ad6
|
|
@ -409,7 +409,7 @@ void NetScope::evaluate_parameter_logic_(Design*des, param_ref_t cur)
|
|||
sure the type is set right. Note that if the parameter
|
||||
doesn't have an explicit type or range, then it will get
|
||||
the signedness from the expression itself. */
|
||||
if ((*cur).second.signed_flag || range_flag) {
|
||||
if (range_flag) {
|
||||
/* If we have a real value convert it to an integer. */
|
||||
if(NetECReal*tmp = dynamic_cast<NetECReal*>(expr)) {
|
||||
verinum nval(tmp->value().as_long64(), (unsigned)lv_width);
|
||||
|
|
@ -419,6 +419,8 @@ void NetScope::evaluate_parameter_logic_(Design*des, param_ref_t cur)
|
|||
}
|
||||
|
||||
(*cur).second.val->cast_signed((*cur).second.signed_flag);
|
||||
} else if ((*cur).second.signed_flag) {
|
||||
(*cur).second.val->cast_signed(true);
|
||||
}
|
||||
|
||||
// If there are no value ranges to test the value against,
|
||||
|
|
|
|||
Loading…
Reference in New Issue