diff --git a/elab_expr.cc b/elab_expr.cc index 29a39c016..ea112eff4 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -444,6 +444,13 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, bool) const return 0; } + if (rep->value().is_zero()) { + cerr << get_line() << ": error: Concatenation repeat " + << "may not be zero." << endl; + des->errors += 1; + return 0; + } + repeat = rep; } diff --git a/elab_net.cc b/elab_net.cc index 8f5a311db..1a01e8057 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -1357,6 +1357,13 @@ NetNet* PEConcat::elaborate_net(Design*des, NetScope*scope, des->errors += 1; return 0; } + + if (erep->value().is_zero()) { + cerr << get_line() << ": error: Concatenation repeat " + << "may not be zero." << endl; + des->errors += 1; + return 0; + } } /* The operands of the concatenation must contain all