From ccf7c042c9be901f79675b05b21137f8ea587275 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Mon, 13 Apr 2015 16:31:28 +0100 Subject: [PATCH] Fix null pointer dereference in debug output. Don't display an elaborated for loop initial assignment if elaboration has failed. Also remove duplicated message. --- elaborate.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index 228733d78..1693b3215 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -4889,7 +4889,7 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const sig->data_type(), sig->vector_width(), expr1_); - if (debug_elaborate) { + if (debug_elaborate && initial_expr) { cerr << get_fileline() << ": debug: FOR initial assign: " << sig->name() << " = " << *initial_expr << endl; } @@ -4900,18 +4900,11 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const reported so it's OK that the netlist is bogus. */ NetProc*sub = statement_->elaborate(des, scope); - /* Now elaborate the for_step statement. I really should do some error checking here to make sure the step statement really does step the variable. */ - if (debug_elaborate) { - cerr << get_fileline() << ": debug: Elaborate for_step statement " - << sig->name() << " = " << *initial_expr << endl; - } - NetProc*step = step_->elaborate(des, scope); - /* Elaborate the condition expression. Try to evaluate it too, in case it is a constant. This is an interesting case worthy of a warning. */