diff --git a/expr_synth.cc b/expr_synth.cc index 005617959..bd031afe9 100644 --- a/expr_synth.cc +++ b/expr_synth.cc @@ -931,11 +931,6 @@ NetNet* NetEUReduce::synthesize(Design*des, NetScope*scope, NetExpr*root) return 0; } - NetNet*osig = new NetNet(scope, scope->local_symbol(), - NetNet::IMPLICIT, 1); - osig->data_type(expr_type()); - osig->local_flag(true); - NetUReduce::TYPE rtype = NetUReduce::NONE; switch (op()) { @@ -966,8 +961,13 @@ NetNet* NetEUReduce::synthesize(Design*des, NetScope*scope, NetExpr*root) NetUReduce*gate = new NetUReduce(scope, scope->local_symbol(), rtype, isig->vector_width()); - des->add_node(gate); + + NetNet*osig = new NetNet(scope, scope->local_symbol(), + NetNet::IMPLICIT, 1); + osig->data_type(expr_type()); + osig->local_flag(true); + connect(gate->pin(0), osig->pin(0)); for (unsigned idx = 0 ; idx < isig->pin_count() ; idx += 1) connect(gate->pin(1+idx), isig->pin(idx)); diff --git a/ivlpp/main.c b/ivlpp/main.c index 9c360fad9..57e1ed866 100644 --- a/ivlpp/main.c +++ b/ivlpp/main.c @@ -365,6 +365,7 @@ int main(int argc, char*argv[]) if (precomp_out_path) { precomp_out = fopen(precomp_out_path, "wb"); if (precomp_out == 0) { + if (out_path) fclose(out); perror(precomp_out_path); exit(1); } @@ -373,6 +374,8 @@ int main(int argc, char*argv[]) if (dep_path) { depend_file = fopen(dep_path, "a"); if (depend_file == 0) { + if (out_path) fclose(out); + if (precomp_out) fclose(precomp_out); perror(dep_path); exit(1); } @@ -380,27 +383,31 @@ int main(int argc, char*argv[]) if (source_cnt == 0) { fprintf(stderr, "%s: No input files given.\n", argv[0]); + if (out_path) fclose(out); + if (depend_file) fclose(depend_file); + if (precomp_out) fclose(precomp_out); return 1; } /* Pass to the lexical analyzer the list of input file, and start scanning. */ reset_lexor(out, source_list); - if (yylex()) return -1; + if (yylex()) { + if (out_path) fclose(out); + if (depend_file) fclose(depend_file); + if (precomp_out) fclose(precomp_out); + return -1; +} destroy_lexor(); - if (depend_file) { - fclose(depend_file); - } + if (depend_file) fclose(depend_file); if (precomp_out) { dump_precompiled_defines(precomp_out); fclose(precomp_out); } - if (out_path) { - fclose(out); - } + if (out_path) fclose(out); /* Free the source and include directory lists. */ for (lp = 0; lp < source_cnt; lp += 1) { diff --git a/tgt-vhdl/expr.cc b/tgt-vhdl/expr.cc index 15c413661..6eb4b42ca 100644 --- a/tgt-vhdl/expr.cc +++ b/tgt-vhdl/expr.cc @@ -536,8 +536,10 @@ static vhdl_expr *translate_ufunc(ivl_expr_t e) int func_scope_sig = 0; for (int i = 0; i < nparams; i++) { vhdl_expr *param = translate_expr(ivl_expr_parm(e, i)); - if (NULL == param) + if (NULL == param) { + delete fcall; return NULL; + } // Ensure the parameter has the correct VHDL type ivl_signal_t param_sig;