Fix mis-randomizing an unpacked struct member when not rand/randc (#8277) (#8278)

This commit is contained in:
Aditya Shevade
2026-09-03 20:08:44 -04:00
committed by GitHub
parent c917f04c65
commit 228635918e
4 changed files with 62 additions and 4 deletions
+3 -1
View File
@@ -4073,7 +4073,9 @@ class RandomizeVisitor final : public VNVisitor {
if (structDtp->packed()) {
randp = newRandStmtsp(fl, stmtsp ? exprp->cloneTree(false) : exprp, nullptr,
outputVarp, offset, smemberp);
} else {
} else if (smemberp->rand().isRandomizable()) {
// IEEE 1800-2023 18.4: an unpacked struct member is only
// randomized if its own declaration carries rand/randc.
AstStructSel* structSelp
= new AstStructSel{fl, exprp->cloneTree(false), smemberp->name()};
structSelp->dtypep(smemberp->childDTypep());