diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 020e109d9..259f116f6 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -2178,22 +2178,22 @@ private: } // TODO Simple dtype checking, should be a more general check - AstNodeArrayDType* loArrayp = exprDTypep->skipRefp()->castUnpackArrayDType(); - AstNodeArrayDType* hiArrayp = modDTypep->skipRefp()->castUnpackArrayDType(); - if (loArrayp && hiArrayp && loArrayp->subDTypep()->skipRefp()->castIfaceRefDType() - && loArrayp->declRange().elements() != hiArrayp->declRange().elements()) { - int loSize = loArrayp->declRange().elements(); - int hiSize = hiArrayp->declRange().elements(); + AstNodeArrayDType* exprArrayp = exprDTypep->skipRefp()->castUnpackArrayDType(); + AstNodeArrayDType* modArrayp = modDTypep->skipRefp()->castUnpackArrayDType(); + if (exprArrayp && modArrayp && exprArrayp->subDTypep()->skipRefp()->castIfaceRefDType() + && exprArrayp->declRange().elements() != modArrayp->declRange().elements()) { + int exprSize = exprArrayp->declRange().elements(); + int modSize = modArrayp->declRange().elements(); nodep->v3error("Illegal "<prettyOperatorName()<<"," - <<" mismatch between port which is an interface array of size "<skipRefp()<skipRefp()<v3error("Illegal "<prettyOperatorName()<<"," - <<" mismatch between port which is"<<(loArrayp?"":" not")<<" an array," - <<" and expression which is"<<(hiArrayp?"":" not")<<" an array."); + <<" mismatch between port which is"<<(modArrayp?"":" not")<<" an array," + <<" and expression which is"<<(exprArrayp?"":" not")<<" an array."); UINFO(1," Related lo: "<skipRefp()<skipRefp()<1, expect=> -q{%Error: t/t_interface_size_bad.v:\d+: Illegal IFACEREF port connection 'foo', mismatch between port which is an interface array of size 4, and expression which is an interface array of size 5. -%Error: t/t_interface_size_bad.v:\d+: Illegal IFACEREF port connection 'foo', mismatch between port which is an interface array of size 6, and expression which is an interface array of size 5. +q{%Error: t/t_interface_size_bad.v:\d+: Illegal IFACEREF port connection 'foo', mismatch between port which is an interface array of size 5, and expression which is an interface array of size 4. +%Error: t/t_interface_size_bad.v:\d+: Illegal IFACEREF port connection 'foo', mismatch between port which is an interface array of size 5, and expression which is an interface array of size 6. %Error: Exiting due to.*}, );