Fix packed array structure replication.

This commit is contained in:
Wilson Snyder
2023-02-13 07:49:08 -05:00
parent 3f4b7af8a1
commit 50929e5d43
4 changed files with 57 additions and 2 deletions
+8 -1
View File
@@ -58,6 +58,7 @@ class SliceVisitor final : public VNVisitor {
// STATE
AstNode* m_assignp = nullptr; // Assignment we are under
bool m_assignError = false; // True if the current assign already has an error
bool m_okInitArray = false; // Allow InitArray children
// METHODS
AstNodeExpr* cloneAndSel(AstNode* nodep, int elements, int offset) {
@@ -163,8 +164,14 @@ class SliceVisitor final : public VNVisitor {
}
}
void visit(AstConsPackUOrStruct* nodep) override {
VL_RESTORER(m_okInitArray);
m_okInitArray = true;
iterateChildren(nodep);
}
void visit(AstInitArray* nodep) override {
UASSERT_OBJ(!m_assignp, nodep, "Array initialization should have been removed earlier");
UASSERT_OBJ(!m_assignp || m_okInitArray, nodep,
"Array initialization should have been removed earlier");
}
void expandBiOp(AstNodeBiop* nodep) {