From 19e266159ef651e1cc3d08241861ea4a9513cb10 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 31 Mar 2013 19:57:37 +0100 Subject: [PATCH] Fix for br924. Prevent compiler crashes after a function argument fails to be elaborated (back-ported from development). --- elab_expr.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/elab_expr.cc b/elab_expr.cc index 59f846454..47b4eb477 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -1562,6 +1562,7 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope, of the function being called. The scope of the called function is elaborated when the definition is elaborated. */ + unsigned parm_errors = 0; unsigned missing_parms = 0; for (unsigned idx = 0 ; idx < parms.count() ; idx += 1) { PExpr*tmp = parms_[idx]; @@ -1570,6 +1571,11 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope, def->port(idx)->data_type(), def->port(idx)->vector_width(), tmp); + if (parms[idx] == 0) { + parm_errors += 1; + continue; + } + if (NetEEvent*evt = dynamic_cast (parms[idx])) { cerr << evt->get_fileline() << ": error: An event '" << evt->event()->name() << "' can not be a user " @@ -1595,8 +1601,11 @@ NetExpr* PECallFunction::elaborate_expr(Design*des, NetScope*scope, cerr << get_fileline() << ": : Verilog doesn't allow " << "passing empty parameters to functions." << endl; des->errors += 1; + return 0; } + if (parm_errors > 0) + return 0; /* Look for the return value signal for the called function. This return value is a magic signal in the scope