diff --git a/elab_expr.cc b/elab_expr.cc index 90c1937fc..d452b31e4 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -716,6 +716,15 @@ NetExpr* PEConcat::elaborate_expr(Design*des, NetScope*scope, des->errors += 1; } + if (!rep->value().is_defined()) { + cerr << get_fileline() << ": error: Concatenation repeat " + << "may not be undefined (" << rep->value() + << ")." << endl; + des->errors += 1; + concat_depth -= 1; + return 0; + } + if (rep->value().is_negative()) { cerr << get_fileline() << ": error: Concatenation repeat " << "may not be negative (" << rep->value().as_long() diff --git a/elab_net.cc b/elab_net.cc index 97fcb76cd..2e9224483 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -1578,6 +1578,14 @@ NetNet* PEConcat::elaborate_net(Design*des, NetScope*scope, return 0; } + if (!erep->value().is_defined()) { + cerr << get_fileline() << ": error: Concatenation repeat " + << "may not be undefined (" << erep->value() + << ")." << endl; + des->errors += 1; + return 0; + } + if (erep->value().is_negative()) { cerr << get_fileline() << ": error: Concatenation repeat " << "may not be negative (" << erep->value().as_long()