Catch unindexed memory reference.

This commit is contained in:
steve 1999-10-18 00:02:21 +00:00
parent 07e2b2b828
commit 8ab03fa90f
2 changed files with 19 additions and 2 deletions

View File

@ -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 File

@ -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.
*