From 043b7ae684d8a9313a0facd7679475572aaf47d1 Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 26 Oct 2007 16:46:04 -0700 Subject: [PATCH] v0_8: warn about unused variable in for loop. This patch back ports from the development branch a warning when an undefined variable is used in a for loop. --- elaborate.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/elaborate.cc b/elaborate.cc index 50734d53d..686d39b6a 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -2356,6 +2356,13 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const the for loop. This is also a very specific assignment statement. Put this into the "body" block. */ sig = des->find_signal(scope, id2->path()); + if (sig == 0) { + cerr << get_line() << ": error: Unable to find variable " + << id2->path() << " in for-loop increment expression." << endl; + des->errors += 1; + return body; + } + assert(sig); lv = new NetAssign_(sig);