Fix segmentation fault on member compare (#5853).

This commit is contained in:
Wilson Snyder 2025-03-12 08:06:34 -04:00
parent 45add07205
commit 391d4e1c32
3 changed files with 5 additions and 4 deletions

View File

@ -41,6 +41,7 @@ Verilator 5.035 devel
* Fix splitting of packed ports with non-zero based ranges (#5842). [Geza Lore]
* Fix NBA shared flag reuse (#5848). [Geza Lore]
* Fix removal of callbacks no longer in current list (#5851) (#5852). [Gilberto Abram]
* Fix segmentation fault on member compare (#5853).
Verilator 5.034 2025-02-24

View File

@ -189,8 +189,8 @@ bool AstVarRef::sameNode(const AstVarRef* samep) const {
return (varScopep() == samep->varScopep() && access() == samep->access());
} else {
return (selfPointer() == samep->selfPointer()
&& classOrPackagep() == samep->classOrPackagep()
&& varp()->name() == samep->varp()->name() && access() == samep->access());
&& classOrPackagep() == samep->classOrPackagep() && access() == samep->access()
&& (varp() && samep->varp() && varp()->name() == samep->varp()->name()));
}
}
bool AstVarRef::sameNoLvalue(AstVarRef* samep) const {

View File

@ -1995,8 +1995,8 @@ AstMemberSel::AstMemberSel(FileLine* fl, AstNodeExpr* fromp, AstVar* varp)
}
bool AstMemberSel::sameNode(const AstNode* samep) const {
const AstMemberSel* const sp = VN_DBG_AS(samep, MemberSel);
return sp != nullptr && access() == sp->access() && fromp()->isSame(sp->fromp())
&& name() == sp->name() && varp()->sameNode(sp->varp());
return sp && access() == sp->access() && fromp()->isSame(sp->fromp()) && name() == sp->name()
&& (varp() && sp->varp() && varp()->sameNode(sp->varp()));
}
void AstMemberSel::dump(std::ostream& str) const {