diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 8e454540b..047b0810d 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -923,8 +923,9 @@ private: if (ccastp) { andp->replaceWith(ccastp); VL_DO_DANGLING(andp->deleteTree(), andp); + return true; } - return ccastp; + return false; } static bool operandAndOrSame(const AstNode* nodep) { @@ -2217,8 +2218,8 @@ private: void swapSides(AstNodeBiCom* nodep) { // COMMUTATIVE({a},CONST) -> COMMUTATIVE(CONST,{a}) // This simplifies later optimizations - AstNode* lhsp = nodep->lhsp()->unlinkFrBackWithNext(); - AstNode* rhsp = nodep->rhsp()->unlinkFrBackWithNext(); + AstNode* const lhsp = nodep->lhsp()->unlinkFrBackWithNext(); + AstNode* const rhsp = nodep->rhsp()->unlinkFrBackWithNext(); nodep->lhsp(rhsp); nodep->rhsp(lhsp); iterate(nodep); // Again? @@ -2227,8 +2228,8 @@ private: int operandConcatMove(AstConcat* nodep) { // CONCAT under concat (See moveConcat) // Return value: true indicates to do it; 2 means move to LHS - AstConcat* abConcp = VN_CAST(nodep->lhsp(), Concat); - AstConcat* bcConcp = VN_CAST(nodep->rhsp(), Concat); + AstConcat* const abConcp = VN_CAST(nodep->lhsp(), Concat); + AstConcat* const bcConcp = VN_CAST(nodep->rhsp(), Concat); if (!abConcp && !bcConcp) return 0; if (bcConcp) { AstNode* ap = nodep->lhsp(); diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 6fd9ee2ec..4bf588b77 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -2195,12 +2195,13 @@ private: virtual void visit(AstInitArray* nodep) override { // InitArray has type of the array; children are array values if (m_vup->prelim()) { // First stage evaluation - AstNodeDType* vdtypep = m_vup->dtypep(); + AstNodeDType* const vdtypep = m_vup->dtypeNullp(); UASSERT_OBJ(vdtypep, nodep, "InitArray type not assigned by AstPattern/Var visitor"); nodep->dtypep(vdtypep); - if (AstNodeArrayDType* arrayp = VN_CAST(vdtypep->skipRefp(), NodeArrayDType)) { + if (AstNodeArrayDType* const arrayp = VN_CAST(vdtypep->skipRefp(), NodeArrayDType)) { userIterateChildren(nodep, WidthVP(arrayp->subDTypep(), BOTH).p()); } else { + UINFO(1, "dtype object " << vdtypep->skipRefp() << endl); nodep->v3fatalSrc("InitArray on non-array"); } }