From d5c9369103d7c885e4bc1c4b89b9a53379b7a8be Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Thu, 1 Jul 2021 19:33:44 +0100 Subject: [PATCH] Internals: Fix suspicious dtype clone relinking. (#3056) --- src/V3Ast.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 31f819c53..e4d36cb60 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -932,7 +932,9 @@ AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v) { void AstNode::cloneRelinkTree() { // private: Cleanup clone() operation on whole tree. Publicly call cloneTree() instead. for (AstNode* nodep = this; nodep; nodep = nodep->m_nextp) { - if (m_dtypep && m_dtypep->clonep()) m_dtypep = m_dtypep->clonep(); + if (nodep->m_dtypep && nodep->m_dtypep->clonep()) { + nodep->m_dtypep = nodep->m_dtypep->clonep(); + } nodep->cloneRelink(); if (nodep->m_op1p) nodep->m_op1p->cloneRelinkTree(); if (nodep->m_op2p) nodep->m_op2p->cloneRelinkTree();