From 8364f509e31c187351bbc193a351aad90480c725 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sat, 2 Dec 2017 18:52:05 +0100 Subject: [PATCH] Fix error handling for nested always/initial --- frontends/ast/genrtlil.cc | 2 ++ frontends/ast/simplify.cc | 3 +++ 2 files changed, 5 insertions(+) diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc index 6c2eafacd..3b08fc28d 100644 --- a/frontends/ast/genrtlil.cc +++ b/frontends/ast/genrtlil.cc @@ -554,6 +554,8 @@ struct AST_INTERNAL::ProcessGenerator break; default: + // ast->dumpAst(NULL, "ast> "); + // current_ast_mod->dumpAst(NULL, "mod> "); log_abort(); } } diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 74e7b4675..f61f7cf7c 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -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; -- 2.30.2