Fix rand dynamic arrays with null handles (#5594)

l
This commit is contained in:
Ryszard Rozak
2024-11-08 06:53:43 -05:00
committed by GitHub
parent 2e1128b417
commit 6083480abb
2 changed files with 10 additions and 1 deletions
+4 -1
View File
@@ -1471,9 +1471,12 @@ class RandomizeVisitor final : public VNVisitor {
AstMethodCall* const callp = new AstMethodCall{fl, exprp, "randomize", nullptr};
callp->taskp(memberFuncp);
callp->dtypeFrom(memberFuncp);
return new AstAssign{
AstAssign* const assignp = new AstAssign{
fl, new AstVarRef{fl, outputVarp, VAccess::WRITE},
new AstAnd{fl, new AstVarRef{fl, outputVarp, VAccess::READ}, callp}};
return new AstIf{
fl, new AstNeq{fl, exprp->cloneTree(false), new AstConst{fl, AstConst::Null{}}},
assignp};
} else if (AstDynArrayDType* const dynarrayDtp = VN_CAST(memberDtp, DynArrayDType)) {
return createArrayForeachLoop(fl, dynarrayDtp, exprp, outputVarp);
} else if (AstQueueDType* const queueDtp = VN_CAST(memberDtp, QueueDType)) {