From 1c5e5704f5310409a5e56f26af7a1cc4f06ccd31 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Wed, 20 Jul 2022 13:07:26 +0100 Subject: [PATCH] Fix iteration fixup in AstNode::addHereThisAsNext Previous version broke verialor_ext_tests due to iteration order mismatch after 3fc8249429a3cde8c925f1ef6ff87bc82865121e --- src/V3Ast.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 5518a98a8..9a6e7fca8 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -674,10 +674,10 @@ void AstNode::addHereThisAsNext(AstNode* newp) { tailp->m_headtailp = newp; } // Iterator fixup - if (newLastp->m_iterpp) { - *(newLastp->m_iterpp) = this; - } else if (this->m_iterpp) { + if (newLastp->m_iterpp) *(newLastp->m_iterpp) = this; + if (this->m_iterpp) { *(this->m_iterpp) = newp; + this->m_iterpp = nullptr; } // debugTreeChange(this, "-addHereThisAsNext: ", __LINE__, true);