From aea202b2e910df81f8db8373d75b71984a0d8089 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 3 Jan 2023 08:08:09 -0800 Subject: [PATCH] PECallFunction: Handle empty parameters in has_aa_term() and declare_implicit_nets() A function parameter can be an empty value, in which case its expression is a nullptr and can not be dereferenced. Make sure this case is handled in the has_aa_term() and declare_implicit_nets() methods. Signed-off-by: Lars-Peter Clausen --- PExpr.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PExpr.cc b/PExpr.cc index 8454ad930..d898dbf6e 100644 --- a/PExpr.cc +++ b/PExpr.cc @@ -286,7 +286,8 @@ PECallFunction::~PECallFunction() void PECallFunction::declare_implicit_nets(LexicalScope*scope, NetNet::Type type) { for (unsigned idx = 0 ; idx < parms_.size() ; idx += 1) { - parms_[idx]->declare_implicit_nets(scope, type); + if (parms_[idx]) + parms_[idx]->declare_implicit_nets(scope, type); } } @@ -294,7 +295,8 @@ bool PECallFunction::has_aa_term(Design*des, NetScope*scope) const { bool flag = false; for (unsigned idx = 0 ; idx < parms_.size() ; idx += 1) { - flag = parms_[idx]->has_aa_term(des, scope) || flag; + if (parms_[idx]) + flag |= parms_[idx]->has_aa_term(des, scope); } return flag; }