No assign alias for unpacked public variables (#2089)

Public variables are all emitted in the C code and unpacked arrays
arrays are sliced up for this. After inlining public unpacked array
assignments should not be alias assignments but actual assignments, so
that they are sliced and hence emitted properly.

Fixes #2073
This commit is contained in:
Stefan Wallentowitz
2020-01-03 13:44:45 +01:00
committed by GitHub
parent 1957b1ebbd
commit 924fe235a9
3 changed files with 51 additions and 0 deletions
+9
View File
@@ -322,6 +322,15 @@ private:
new AstAssignW(nodep->fileline(),
new AstVarRef(nodep->fileline(), exprvarrefp->varp(), true),
new AstVarRef(nodep->fileline(), nodep, false)));
} else if (nodep->isSigPublic() && VN_IS(nodep->dtypep(), UnpackArrayDType)) {
// Public variable at this end and it is an unpacked array. We need to assign
// instead of aliased, because otherwise it will pass V3Slice and invalid
// code will be emitted.
UINFO(9,"assign to public and unpacked: "<<nodep<<endl);
m_modp->addStmtp(
new AstAssignW(nodep->fileline(),
new AstVarRef(nodep->fileline(), exprvarrefp->varp(), true),
new AstVarRef(nodep->fileline(), nodep, false)));
} else if (nodep->isIfaceRef()) {
m_modp->addStmtp(
new AstAssignVarScope(nodep->fileline(),