From 1f5b11246e7bd6befc2e3110bbe7dc81b5a13c06 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 14 Aug 2008 12:40:53 -0700 Subject: [PATCH] Correctly pass a concatenation elaboration error. Because Icarus tries to elaborate as much as it can even after an error has occurred we need to check for these errors during elaboration. This patch prevent an undefined identifier from crashing the compiler. --- elaborate.cc | 4 ++-- net_nex_input.cc | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index ad7c273ab..332c976eb 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -2649,8 +2649,8 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope, } NexusSet*nset = enet->nex_input(rem_out); if (nset == 0) { - cerr << get_fileline() << ": internal error: No NexusSet" - << " from statement." << endl; + cerr << get_fileline() << ": error: Unable to elaborate:" + << endl; enet->dump(cerr, 6); des->errors += 1; return enet; diff --git a/net_nex_input.cc b/net_nex_input.cc index 2a68c2a8b..0f97c2a44 100644 --- a/net_nex_input.cc +++ b/net_nex_input.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2007 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2008 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -53,8 +53,13 @@ NexusSet* NetEBinary::nex_input(bool rem_out) NexusSet* NetEConcat::nex_input(bool rem_out) { + if (parms_[0] == NULL) return NULL; NexusSet*result = parms_[0]->nex_input(rem_out); for (unsigned idx = 1 ; idx < parms_.count() ; idx += 1) { + if (parms_[idx] == NULL) { + delete result; + return NULL; + } NexusSet*tmp = parms_[idx]->nex_input(rem_out); result->add(*tmp); delete tmp; @@ -98,6 +103,10 @@ NexusSet* NetESelect::nex_input(bool rem_out) { NexusSet*result = base_? base_->nex_input(rem_out) : new NexusSet(); NexusSet*tmp = expr_->nex_input(rem_out); + if (tmp == NULL) { + delete result; + return NULL; + } result->add(*tmp); delete tmp; return result; @@ -381,4 +390,3 @@ NexusSet* NetWhile::nex_input(bool rem_out) delete tmp; return result; } -