Handle error case of zero width in indexed part select.

The compiler doesn't currently check that the width of an indexed
part select is non-zero. If code contains this erroneous case, the
compiler can crash (with an assertion failure). This patch causes
the compiler to output a suitable error message and recover. It
also fixes a potential crash if an illegal expresson is encountered.
This commit is contained in:
Martin Whitaker
2012-07-27 18:42:43 -07:00
committed by Stephen Williams
parent a5a512758e
commit c4ff8300d3
2 changed files with 10 additions and 6 deletions
+1
View File
@@ -1064,6 +1064,7 @@ NetNet* NetESelect::synthesize(Design *des, NetScope*scope, NetExpr*root)
NetPartSelect::VP);
des->add_node(sel);
ivl_assert(*this, select_width > 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, select_width);
tmp->set_line(*this);