diff --git a/elaborate.cc b/elaborate.cc index 8ca2924a7..4904493a2 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2015 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 @@ -3615,6 +3615,8 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const /* Make the r-value of the initial assignment, and size it properly. Then use it to build the assignment statement. */ etmp = elab_and_eval(des, scope, expr1_, use_width); + if (etmp == 0) + return 0; etmp->set_width(use_width); etmp = pad_to_width(etmp, use_width, *this); @@ -3667,6 +3669,8 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const /* Make the rvalue of the increment expression, and size it for the lvalue. */ etmp = elab_and_eval(des, scope, expr2_, lv->lwidth()); + if (etmp == 0) + return 0; NetAssign*step = new NetAssign(lv, etmp); step->set_line(*this); @@ -3891,8 +3895,14 @@ NetProc* PTrigger::elaborate(Design*des, NetScope*scope) const NetProc* PWhile::elaborate(Design*des, NetScope*scope) const { probe_expr_width(des, scope, cond_); - NetExpr*tmp = elab_and_eval(des, scope, cond_, -1); - NetWhile*loop = new NetWhile(tmp, statement_->elaborate(des, scope)); + NetExpr*ce = elab_and_eval(des, scope, cond_, -1); + NetProc*sub = statement_->elaborate(des, scope); + if (ce == 0 || sub == 0) { + delete ce; + delete sub; + return 0; + } + NetWhile*loop = new NetWhile(ce, sub); return loop; } diff --git a/net_nex_output.cc b/net_nex_output.cc index e2d025784..0b381a2c5 100644 --- a/net_nex_output.cc +++ b/net_nex_output.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2007 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2015 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 @@ -103,6 +103,11 @@ void NetPDelay::nex_output(NexusSet&out) if (statement_) statement_->nex_output(out); } +void NetRepeat::nex_output(NexusSet&out) +{ + if (statement_) statement_->nex_output(out); +} + /* * For the purposes of synthesis, system task calls have no output at * all. This is OK because most system tasks are not synthesizable in diff --git a/netlist.h b/netlist.h index 300ea885f..749960802 100644 --- a/netlist.h +++ b/netlist.h @@ -1,7 +1,7 @@ #ifndef __netlist_H #define __netlist_H /* - * Copyright (c) 1998-2010 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2015 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 @@ -2924,6 +2924,7 @@ class NetRepeat : public NetProc { void emit_recurse(struct target_t*) const; virtual NexusSet* nex_input(bool rem_out = true); + virtual void nex_output(NexusSet&); virtual bool emit_proc(struct target_t*) const; virtual void dump(ostream&, unsigned ind) const; virtual DelayType delay_type() const;