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.
This commit is contained in:
Cary R 2008-08-14 12:40:53 -07:00 committed by Stephen Williams
parent d3caa547ba
commit 1f5b11246e
2 changed files with 12 additions and 4 deletions

View File

@ -2649,8 +2649,8 @@ NetProc* PEventStatement::elaborate_st(Design*des, NetScope*scope,
} }
NexusSet*nset = enet->nex_input(rem_out); NexusSet*nset = enet->nex_input(rem_out);
if (nset == 0) { if (nset == 0) {
cerr << get_fileline() << ": internal error: No NexusSet" cerr << get_fileline() << ": error: Unable to elaborate:"
<< " from statement." << endl; << endl;
enet->dump(cerr, 6); enet->dump(cerr, 6);
des->errors += 1; des->errors += 1;
return enet; return enet;

View File

@ -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 * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * 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) NexusSet* NetEConcat::nex_input(bool rem_out)
{ {
if (parms_[0] == NULL) return NULL;
NexusSet*result = parms_[0]->nex_input(rem_out); NexusSet*result = parms_[0]->nex_input(rem_out);
for (unsigned idx = 1 ; idx < parms_.count() ; idx += 1) { 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); NexusSet*tmp = parms_[idx]->nex_input(rem_out);
result->add(*tmp); result->add(*tmp);
delete 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*result = base_? base_->nex_input(rem_out) : new NexusSet();
NexusSet*tmp = expr_->nex_input(rem_out); NexusSet*tmp = expr_->nex_input(rem_out);
if (tmp == NULL) {
delete result;
return NULL;
}
result->add(*tmp); result->add(*tmp);
delete tmp; delete tmp;
return result; return result;
@ -381,4 +390,3 @@ NexusSet* NetWhile::nex_input(bool rem_out)
delete tmp; delete tmp;
return result; return result;
} }