Fix multidim dynamic array elements passed to ref argument (#7023)

This commit is contained in:
Ryszard Rozak
2026-02-10 08:46:04 +01:00
committed by GitHub
parent a660fa54a7
commit 6303eb45ce
3 changed files with 116 additions and 39 deletions
+11 -4
View File
@@ -508,6 +508,16 @@ class TaskVisitor final : public VNVisitor {
return assp;
}
void changeAtWriteRecurse(AstNodeExpr* const exprp) {
// Change nested at methods to writable variant
if (AstCMethodHard* const cMethodp = VN_CAST(exprp, CMethodHard)) {
if (cMethodp->method() == VCMethod::ARRAY_AT) {
cMethodp->method(VCMethod::ARRAY_AT_WRITE);
}
changeAtWriteRecurse(cMethodp->fromp());
}
}
void connectPort(AstVar* portp, AstArg* argp, const string& namePrefix, AstNode* beginp,
bool inlineTask) {
AstNodeExpr* const pinp = argp->exprp();
@@ -538,10 +548,7 @@ class TaskVisitor final : public VNVisitor {
refArgOk = cMethodp->method() == VCMethod::DYN_AT_WRITE_APPEND
|| cMethodp->method() == VCMethod::DYN_AT_WRITE_APPEND_BACK;
} else {
if (cMethodp->method() == VCMethod::ARRAY_AT) {
// Change the method to writable variant
cMethodp->method(VCMethod::ARRAY_AT_WRITE);
}
changeAtWriteRecurse(cMethodp);
refArgOk = cMethodp->method() == VCMethod::ARRAY_AT_WRITE;
}
}