diff --git a/elab_expr.cc b/elab_expr.cc index 0ea90b1e5..25ed905eb 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: elab_expr.cc,v 1.6 1999/09/30 02:43:02 steve Exp $" +#ident "$Id: elab_expr.cc,v 1.7 1999/10/18 00:02:21 steve Exp $" #endif @@ -261,6 +261,12 @@ NetExpr* PEIdent::elaborate_expr(Design*des, const string&path) const // memory reference and I must generate a NetEMemory // object to handle it. if (NetMemory*mem = des->find_memory(name)) { + if (msb_ == 0) { + cerr << get_line() << ": error: Memory ``" << name << + "'' referenced without an index expression." << endl; + des->errors += 1; + return 0; + } assert(msb_ != 0); assert(lsb_ == 0); assert(idx_ == 0); @@ -318,6 +324,9 @@ NetExpr*PETernary::elaborate_expr(Design*des, const string&path) const /* * $Log: elab_expr.cc,v $ + * Revision 1.7 1999/10/18 00:02:21 steve + * Catch unindexed memory reference. + * * Revision 1.6 1999/09/30 02:43:02 steve * Elaborate ~^ and ~| operators. * diff --git a/elaborate.cc b/elaborate.cc index 016343641..ed1d97910 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: elaborate.cc,v 1.117 1999/10/13 03:16:36 steve Exp $" +#ident "$Id: elaborate.cc,v 1.118 1999/10/18 00:02:21 steve Exp $" #endif /* @@ -2286,6 +2286,11 @@ NetProc* PForStatement::elaborate(Design*des, const string&path) const in case it is a constant. This is an interesting case worthy of a warning. */ NetExpr*ce = cond_->elaborate_expr(des, path); + if (ce == 0) { + delete top; + return 0; + } + if (NetExpr*tmp = ce->eval_tree()) { if (dynamic_cast(tmp)) cerr << get_line() << ": warning: condition expression " @@ -2638,6 +2643,9 @@ Design* elaborate(const map&modules, /* * $Log: elaborate.cc,v $ + * Revision 1.118 1999/10/18 00:02:21 steve + * Catch unindexed memory reference. + * * Revision 1.117 1999/10/13 03:16:36 steve * Remove commented out do_assign. *