Fix crash on block with assignments that assign lval to self.

This commit is contained in:
steve 2005-12-10 03:30:50 +00:00
parent b6d5a0675e
commit d5d03812cd
2 changed files with 32 additions and 5 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elaborate.cc,v 1.308.2.1 2005/11/13 22:28:14 steve Exp $"
#ident "$Id: elaborate.cc,v 1.308.2.2 2005/12/10 03:30:50 steve Exp $"
#endif
# include "config.h"
@ -1215,6 +1215,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
/* And build up the complex statement. */
NetBlock*bl = new NetBlock(NetBlock::SEQU, 0);
bl->set_line(*this);
bl->append(a1);
bl->append(st);
@ -1318,6 +1319,7 @@ NetProc* PBlock::elaborate(Design*des, NetScope*scope) const
}
NetBlock*cur = new NetBlock(type, nscope);
cur->set_line(*this);
bool fail_flag = false;
if (nscope == 0)
@ -1462,8 +1464,11 @@ NetProc* PCondit::elaborate(Design*des, NetScope*scope) const
return if_->elaborate(des, scope);
else if (else_)
return else_->elaborate(des, scope);
else
return new NetBlock(NetBlock::SEQU, 0);
else {
NetBlock*tmp = new NetBlock(NetBlock::SEQU, 0);
tmp->set_line(*this);
return tmp;
}
}
// If the condition expression is more then 1 bits, then
@ -1632,6 +1637,7 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const
}
NetBlock*block = new NetBlock(NetBlock::SEQU, 0);
block->set_line(*this);
/* Detect the case where the definition of the task is known
@ -2488,6 +2494,7 @@ void PTask::elaborate(Design*des, NetScope*task) const
NetProc*st;
if (statement_ == 0) {
st = new NetBlock(NetBlock::SEQU, 0);
st->set_line(*this);
} else {
@ -2776,6 +2783,9 @@ Design* elaborate(list<perm_string>roots)
/*
* $Log: elaborate.cc,v $
* Revision 1.308.2.2 2005/12/10 03:30:50 steve
* Fix crash on block with assignments that assign lval to self.
*
* Revision 1.308.2.1 2005/11/13 22:28:14 steve
* Do not panic if case statement is nul.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: synth2.cc,v 1.39.2.6 2005/12/07 02:14:37 steve Exp $"
#ident "$Id: synth2.cc,v 1.39.2.7 2005/12/10 03:30:51 steve Exp $"
#endif
# include "config.h"
@ -183,6 +183,7 @@ bool NetBlock::synth_async(Design*des, NetScope*scope,
output. */
NetNet*tmp_out = new NetNet(scope, tmp2, NetNet::WIRE,
tmp_set.count());
tmp_out->set_line(*this);
/* Make a temporary set of currently accumulated outputs
that we can pass to the synth_async of the
@ -202,6 +203,10 @@ bool NetBlock::synth_async(Design*des, NetScope*scope,
delete new_accum;
/* NOTE: tmp_set is not valid after this point, since
the cur->synth_async method may change nexa that it
refers to. */
if (ok_flag == false)
continue;
@ -210,11 +215,20 @@ bool NetBlock::synth_async(Design*des, NetScope*scope,
or that will be the output of the block. */
new_accum = new NetNet(scope, tmp3, NetNet::WIRE,
nex_out->pin_count());
new_accum->set_line(*this);
/* Use the nex_map to link up the output from the
substatement to the output of the block as a whole. */
for (unsigned idx = 0 ; idx < tmp_out->pin_count() ; idx += 1) {
unsigned ptr = find_nexus_in_set(nex_map, tmp_set[idx]);
unsigned ptr = find_nexus_in_set(nex_map, tmp_map->pin(idx).nexus());
if (ptr >= nex_map->pin_count()) {
cerr << cur->get_line() << ": internal error: "
<< "Nexus isn't in nex_map?! idx=" << idx
<< " map width = " << nex_map->pin_count()
<< " tmp_map count = " << tmp_map->pin_count()
<< endl;
}
assert(ptr < new_accum->pin_count());
connect(new_accum->pin(ptr), tmp_out->pin(idx));
}
@ -1182,6 +1196,9 @@ void synth2(Design*des)
/*
* $Log: synth2.cc,v $
* Revision 1.39.2.7 2005/12/10 03:30:51 steve
* Fix crash on block with assignments that assign lval to self.
*
* Revision 1.39.2.6 2005/12/07 02:14:37 steve
* Error messages for missing else clauses.
*