8000 Fix crash when comparing queue to scalar (#5570) by hankhsu1996 · Pull Request #5950 · verilator/verilator · GitHub
[go: up one dir, main page]

Skip to content

Fix crash when comparing queue to scalar (#5570) #5950

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 20, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into bugfix/queue-compare
  • Loading branch information
hankhsu1996 committed May 19, 2025
commit c512f7a333435d7a28dba44e6cdcba2457f415f8
22 changes: 18 additions & 4 deleti 8000 ons src/V3Slice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,27 @@ class SliceVisitor final : public VNVisitor {
const AstNodeDType* const fromDtp = nodep->lhsp()->dtypep()->skipRefp();
if (const AstUnpackArrayDType* const adtypep = VN_CAST(fromDtp, UnpackArrayDType)) {
AstNodeBiop* logp = nullptr;

const int elements = adtypep->rangep()->elementsConst();
for (int elemIdx = 0; elemIdx < elements; ++elemIdx) {
// EQ(a,b) -> LOGAND(EQ(ARRAYSEL(a,0), ARRAYSEL(b,0)), ...[1])
AstNodeBiop* const clonep
= VN_AS(nodep->cloneType(cloneAndSel(nodep->lhsp(), elements, elemIdx),
cloneAndSel(nodep->rhsp(), elements, elemIdx)),
NodeBiop);
// Original node is replaced, so it is safe to copy it one time even if it is
// impure.
AstNodeBiop* const clonep = VN_AS(
nodep->cloneType(cloneAndSel(nodep->lhsp(), elements, elemIdx, elemIdx != 0),
cloneAndSel(nodep->rhsp(), elements, elemIdx, elemIdx != 0)),
NodeBiop);
if (elemIdx == 0) {
nodep->foreach([this](AstExprStmt* const exprp) {
// Result expression is always evaluated to the same value, so the
// statements can be removed once they were included in the expression
// created for the 1st element.
AstNodeExpr* const resultp = exprp->resultp()->unlinkFrBack();
exprp->replaceWith(resultp);
VL_DO_DANGLING(pushDeletep(exprp), exprp);
});
}

if (!logp) {
logp = clonep;
} else {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0