Fix error handling for nested always/initial
authorClifford Wolf <clifford@clifford.at>
Sat, 2 Dec 2017 17:52:05 +0000 (18:52 +0100)
committerClifford Wolf <clifford@clifford.at>
Sat, 2 Dec 2017 17:52:05 +0000 (18:52 +0100)
frontends/ast/genrtlil.cc
frontends/ast/simplify.cc

index 6c2eafacdef4b8ba310437572014a7de45ac86da..3b08fc28db9c620f1add24d97234505ab2f9338f 100644 (file)
@@ -554,6 +554,8 @@ struct AST_INTERNAL::ProcessGenerator
                        break;
 
                default:
+                       // ast->dumpAst(NULL, "ast> ");
+                       // current_ast_mod->dumpAst(NULL, "mod> ");
                        log_abort();
                }
        }
index 74e7b4675d47cdf49359af46075a7d88940347f7..f61f7cf7ca1730d8a27b42fbcffc775e7fa8fc2b 100644 (file)
@@ -401,6 +401,9 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
 
        if (type == AST_ALWAYS || type == AST_INITIAL)
        {
+               if (current_always != nullptr)
+                       log_error("Invalid nesting of always blocks and/or initializations at %s:%d.\n", filename.c_str(), linenum);
+
                current_always = this;
                current_always_clocked = false;