diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2023-01-17 12:58:08 +0100 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2023-01-17 12:58:08 +0100 |
commit | 6574553189fb6ccb5d00a0c043671a625672b3d3 (patch) | |
tree | 57e3212ee75493d9f4939c9f9029b95880367a76 /frontends/ast | |
parent | 956c4e485a9463863f60c4dd03372db3fa8332a4 (diff) | |
download | yosys-6574553189fb6ccb5d00a0c043671a625672b3d3.tar.gz yosys-6574553189fb6ccb5d00a0c043671a625672b3d3.tar.bz2 yosys-6574553189fb6ccb5d00a0c043671a625672b3d3.zip |
Fixes for some of clang scan-build detected issues
Diffstat (limited to 'frontends/ast')
-rw-r--r-- | frontends/ast/ast.cc | 3 | ||||
-rw-r--r-- | frontends/ast/simplify.cc | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc index 6097f02f5..982943d1b 100644 --- a/frontends/ast/ast.cc +++ b/frontends/ast/ast.cc @@ -1649,7 +1649,7 @@ RTLIL::IdString AstModule::derive(RTLIL::Design *design, const dict<RTLIL::IdStr AstNode *new_ast = NULL; std::string modname = derive_common(design, parameters, &new_ast, quiet); - if (!design->has(modname)) { + if (!design->has(modname) && new_ast) { new_ast->str = modname; process_module(design, new_ast, false, NULL, quiet); design->module(modname)->check(); @@ -1699,6 +1699,7 @@ std::string AST::derived_module_name(std::string stripped_name, const std::vecto std::string AstModule::derive_common(RTLIL::Design *design, const dict<RTLIL::IdString, RTLIL::Const> ¶meters, AstNode **new_ast_out, bool quiet) { std::string stripped_name = name.str(); + (*new_ast_out) = nullptr; if (stripped_name.compare(0, 9, "$abstract") == 0) stripped_name = stripped_name.substr(9); diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index da7933d2f..71a26983b 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -4705,8 +4705,7 @@ void AstNode::mem2reg_as_needed_pass1(dict<AstNode*, pool<std::string>> &mem2reg children_flags |= AstNode::MEM2REG_FL_ASYNC; proc_flags_p = new dict<AstNode*, uint32_t>; } - - if (type == AST_INITIAL) { + else if (type == AST_INITIAL) { children_flags |= AstNode::MEM2REG_FL_INIT; proc_flags_p = new dict<AstNode*, uint32_t>; } |