fix null pointer when elaborating undefined task.

This commit is contained in:
steve 2000-09-24 17:41:13 +00:00
parent e8bb53e2ea
commit cbe20e8bcf
4 changed files with 25 additions and 16 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elab_expr.cc,v 1.27 2000/08/26 01:31:29 steve Exp $" #ident "$Id: elab_expr.cc,v 1.28 2000/09/24 17:41:13 steve Exp $"
#endif #endif
@ -164,7 +164,7 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope) const
if (name_[0] == '$') if (name_[0] == '$')
return elaborate_sfunc_(des, scope); return elaborate_sfunc_(des, scope);
NetFuncDef*def = des->find_function(scope->name(), name_); NetFuncDef*def = des->find_function(scope, name_);
if (def == 0) { if (def == 0) {
cerr << get_line() << ": error: No function " << name_ << cerr << get_line() << ": error: No function " << name_ <<
" in this context (" << scope->name() << ")." << endl; " in this context (" << scope->name() << ")." << endl;
@ -507,6 +507,9 @@ NetEUnary* PEUnary::elaborate_expr(Design*des, NetScope*scope) const
/* /*
* $Log: elab_expr.cc,v $ * $Log: elab_expr.cc,v $
* Revision 1.28 2000/09/24 17:41:13 steve
* fix null pointer when elaborating undefined task.
*
* Revision 1.27 2000/08/26 01:31:29 steve * Revision 1.27 2000/08/26 01:31:29 steve
* Handle out of range part select expressions. * Handle out of range part select expressions.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: elaborate.cc,v 1.190 2000/09/20 02:53:14 steve Exp $" #ident "$Id: elaborate.cc,v 1.191 2000/09/24 17:41:13 steve Exp $"
#endif #endif
/* /*
@ -1262,10 +1262,10 @@ NetProc* PCallTask::elaborate_usr(Design*des, const string&path) const
NetScope*scope = des->find_scope(path); NetScope*scope = des->find_scope(path);
assert(scope); assert(scope);
NetTaskDef*def = des->find_task(path, name_); NetTaskDef*def = des->find_task(scope, name_);
if (def == 0) { if (def == 0) {
cerr << get_line() << ": error: Enable of unknown task ``" << cerr << get_line() << ": error: Enable of unknown task ``" <<
path << "." << name_ << "''." << endl; scope->name() << "." << name_ << "''." << endl;
des->errors += 1; des->errors += 1;
return 0; return 0;
} }
@ -2257,6 +2257,9 @@ Design* elaborate(const map<string,Module*>&modules,
/* /*
* $Log: elaborate.cc,v $ * $Log: elaborate.cc,v $
* Revision 1.191 2000/09/24 17:41:13 steve
* fix null pointer when elaborating undefined task.
*
* Revision 1.190 2000/09/20 02:53:14 steve * Revision 1.190 2000/09/20 02:53:14 steve
* Correctly measure comples l-values of assignments. * Correctly measure comples l-values of assignments.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: net_design.cc,v 1.15 2000/08/26 00:54:03 steve Exp $" #ident "$Id: net_design.cc,v 1.16 2000/09/24 17:41:13 steve Exp $"
#endif #endif
/* /*
@ -387,12 +387,11 @@ void Design::find_symbol(NetScope*scope, const string&name,
} }
} }
NetFuncDef* Design::find_function(const string&path, const string&name) NetFuncDef* Design::find_function(NetScope*scope, const string&name)
{ {
NetScope*scope = find_scope(path);
assert(scope); assert(scope);
NetScope*func = find_scope(scope, name); NetScope*func = find_scope(scope, name);
if (func->type() == NetScope::FUNC) if (func && (func->type() == NetScope::FUNC))
return func->func_def(); return func->func_def();
return 0; return 0;
@ -407,12 +406,10 @@ NetFuncDef* Design::find_function(const string&key)
return 0; return 0;
} }
NetTaskDef* Design::find_task(const string&path, const string&name) NetTaskDef* Design::find_task(NetScope*scope, const string&name)
{ {
NetScope*scope = find_scope(path);
assert(scope);
NetScope*task = find_scope(scope, name); NetScope*task = find_scope(scope, name);
if (task->type() == NetScope::TASK) if (task && (task->type() == NetScope::TASK))
return task->task_def(); return task->task_def();
return 0; return 0;
@ -489,6 +486,9 @@ void Design::delete_process(NetProcTop*top)
/* /*
* $Log: net_design.cc,v $ * $Log: net_design.cc,v $
* Revision 1.16 2000/09/24 17:41:13 steve
* fix null pointer when elaborating undefined task.
*
* Revision 1.15 2000/08/26 00:54:03 steve * Revision 1.15 2000/08/26 00:54:03 steve
* Get at gate information for ivl_target interface. * Get at gate information for ivl_target interface.
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: netlist.h,v 1.165 2000/09/24 15:44:44 steve Exp $" #ident "$Id: netlist.h,v 1.166 2000/09/24 17:41:13 steve Exp $"
#endif #endif
/* /*
@ -2709,11 +2709,11 @@ class Design {
NetNet*&sig, NetMemory*&mem); NetNet*&sig, NetMemory*&mem);
// Functions // Functions
NetFuncDef* find_function(const string&path, const string&key); NetFuncDef* find_function(NetScope*scope, const string&key);
NetFuncDef* find_function(const string&path); NetFuncDef* find_function(const string&path);
// Tasks // Tasks
NetTaskDef* find_task(const string&path, const string&name); NetTaskDef* find_task(NetScope*scope, const string&name);
NetTaskDef* find_task(const string&key); NetTaskDef* find_task(const string&key);
// NODES // NODES
@ -2799,6 +2799,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
/* /*
* $Log: netlist.h,v $ * $Log: netlist.h,v $
* Revision 1.166 2000/09/24 17:41:13 steve
* fix null pointer when elaborating undefined task.
*
* Revision 1.165 2000/09/24 15:44:44 steve * Revision 1.165 2000/09/24 15:44:44 steve
* Move some NetNet method out of the header file. * Move some NetNet method out of the header file.
* *