An if statement is optional and results in no delay.

While checking for an infinite loop in an always block I missed
the case where an if statement does not have a statement. This
was resulting in a segmentation fault.
This commit is contained in:
Cary R 2010-09-13 09:08:40 -07:00 committed by Stephen Williams
parent b252dc0192
commit 4001c7a27f
1 changed files with 6 additions and 2 deletions

View File

@ -227,7 +227,7 @@ bool NetPins::is_linked(void)
NetObj::NetObj(NetScope*s, perm_string n, unsigned np) NetObj::NetObj(NetScope*s, perm_string n, unsigned np)
: NetPins(np), scope_(s), name_(n), delay1_(0), delay2_(0), delay3_(0) : NetPins(np), scope_(s), name_(n), delay1_(0), delay2_(0), delay3_(0)
{ {
/* Don't /* Don't
ivl_assert(*this, np > 0); ivl_assert(*this, np > 0);
* because it would happen before we get to print a useful * because it would happen before we get to print a useful
* message in the NetNet constructor * message in the NetNet constructor
@ -2697,7 +2697,11 @@ DelayType NetCondit::delay_type() const
} else { } else {
/* Because of the indeterminate conditional value the /* Because of the indeterminate conditional value the
* best we can have for this case is a possible delay. */ * best we can have for this case is a possible delay. */
result = combine_delays(if_->delay_type(), NO_DELAY); if (if_) {
result = combine_delays(if_->delay_type(), NO_DELAY);
} else {
result = NO_DELAY;
}
} }
return result; return result;