diff --git a/src/V3Slice.cpp b/src/V3Slice.cpp index 231eb5fbe..21a01f859 100644 --- a/src/V3Slice.cpp +++ b/src/V3Slice.cpp @@ -67,6 +67,8 @@ class SliceVisitor final : public AstNVisitor { nodep->v3error( nodep->prettyTypeName() << " is not an unpacked array, but is in an unpacked array context"); + } else { + V3Error::incErrors(); // Otherwise might infinite loop } m_assignError = true; return nodep->cloneTree(false); // Likely will cause downstream errors @@ -107,7 +109,7 @@ class SliceVisitor final : public AstNVisitor { : offset)); newp = new AstArraySel(nodep->fileline(), snodep->fromp()->cloneTree(false), leOffset); } else if (VN_IS(nodep, ArraySel) || VN_IS(nodep, NodeVarRef) || VN_IS(nodep, NodeSel) - || VN_IS(nodep, CMethodHard)) { + || VN_IS(nodep, CMethodHard) || VN_IS(nodep, MemberSel)) { UINFO(9, " cloneSel(" << elements << "," << offset << ") " << nodep << endl); int leOffset = !arrayp->rangep()->littleEndian() ? arrayp->rangep()->elementsConst() - 1 - offset diff --git a/test_regress/t/t_class_format.out b/test_regress/t/t_class_format.out index 36d844b8d..f620c0e3f 100644 --- a/test_regress/t/t_class_format.out +++ b/test_regress/t/t_class_format.out @@ -1,2 +1,3 @@ ''{b:'h1, i:'h2a, carray4:'{'h11, 'h22, 'h33, 'h44} }' +''{b:'h1, i:'h2a, carray4:'{'h911, 'h922, 'h933, 'h944} }' *-* All Finished *-* diff --git a/test_regress/t/t_class_format.v b/test_regress/t/t_class_format.v index 9f2240814..001a5284e 100644 --- a/test_regress/t/t_class_format.v +++ b/test_regress/t/t_class_format.v @@ -30,6 +30,9 @@ module t (/*AUTOARG*/); c.carray4[3] = 16'h44; $display("'%p'", c); + c.carray4 = '{16'h911, 16'h922, 16'h933, 16'h944}; + $display("'%p'", c); + $write("*-* All Finished *-*\n"); $finish; end