ast: fix error condition causing assert to fail
authorXiretza <xiretza@xiretza.xyz>
Tue, 16 Mar 2021 23:08:43 +0000 (00:08 +0100)
committerZachary Snow <zachary.j.snow@gmail.com>
Mon, 14 Jun 2021 17:56:51 +0000 (13:56 -0400)
type2str returns a string that doesn't start with $ or \, so it can't be
assigned to an IdString.

frontends/ast/genrtlil.cc

index 52e0574864ede53293bceacd2fb21d01cdfd3d55..6b119b7fff93f6c1f2bdfd188c7c1dd2d6a6bb8f 100644 (file)
@@ -2006,8 +2006,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
        default:
                for (auto f : log_files)
                        current_ast_mod->dumpAst(f, "verilog-ast> ");
-               type_name = type2str(type);
-               log_file_error(filename, location.first_line, "Don't know how to generate RTLIL code for %s node!\n", type_name.c_str());
+               log_file_error(filename, location.first_line, "Don't know how to generate RTLIL code for %s node!\n", type2str(type).c_str());
        }
 
        return RTLIL::SigSpec();