Permalink
Browse files

Catch unindexed memory reference.

  • Loading branch information...
1 parent 07e2b2b commit 8ab03fa90f27146846e1481bd7878c7954654960 steve committed Oct 18, 1999
Showing with 19 additions and 2 deletions.
  1. +10 −1 elab_expr.cc
  2. +9 −1 elaborate.cc
View
@@ -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.
*
View
@@ -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<NetEConst*>(tmp))
cerr << get_line() << ": warning: condition expression "
@@ -2638,6 +2643,9 @@ Design* elaborate(const map<string,Module*>&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.
*

0 comments on commit 8ab03fa

Please sign in to comment.