From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id 35CCF3858D3C for ; Mon, 26 Jul 2021 15:35:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 35CCF3858D3C Received: by mail-pl1-x62c.google.com with SMTP id t21so11920420plr.13 for ; Mon, 26 Jul 2021 08:35:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=iX4f+O2pB9GGb6SeXWGd8Q946HmDkopFSt5EOEG42xo=; b=jtar17NZl1OyX+2Nz3Q8IRUU2VzgjhcPT5u3AjUcUwHFlQ2mhRVZYI4Jp3STCFOZLG Dm2ZEpA8BL9ztf84DWL714nqeVQLSvoLB0k9cCo7gl2wit5uJaT1yTYOZDtG8V1wfT6G cef20/LGr/BXNj2QEKtpUl5hUyXDGr830F0C0gbUhlv6Y+hAoAJMkN3Q2G1ZmTbhPYdV iC+WbJRCu72hezT4ijhaiBIkkt1QK7JfBVUsZIrGyhvizZ0LB6ORl5nG4IYqUZqoK295 J+vjXzalH2yAHkT2PkceeQ8xR6Sfxc8xBH+M8Pn364BAQdNgmg0WX3KockZjryKK/mfl n9ig== X-Gm-Message-State: AOAM5311TrmB0xNLOg8WhQoGeyog6nF3DV9PCIon7wkYmeY5piuk2ldl cnxM2seHfia1LXU1HRNckOqadN6djYXtbg== X-Google-Smtp-Source: ABdhPJwaPbhbh4TUwxqpapAcJTSM6wGRh7IiOFUkwdcfs3liHGiFtwWOkpymW01QWnxrnSR1JWL0+g== X-Received: by 2002:a05:6a00:bd3:b029:329:3e4f:eadb with SMTP id x19-20020a056a000bd3b02903293e4feadbmr18573979pfu.44.1627313701852; Mon, 26 Jul 2021 08:35:01 -0700 (PDT) Received: from [192.168.100.3] ([146.196.34.235]) by smtp.gmail.com with ESMTPSA id v69sm397152pfc.118.2021.07.26.08.34.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jul 2021 08:35:01 -0700 (PDT) From: Ankur Saini Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_5EF4B912-64F0-46AA-A55B-B6A8CB3854E0" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.20.0.2.21\)) Subject: Re: [PATCH] Analyzer: Refactor callstring to work with pairs of supernodes. Date: Mon, 26 Jul 2021 21:04:57 +0530 In-Reply-To: To: gcc Patches References: X-Mailer: Apple Mail (2.3654.20.0.2.21) X-Spam-Status: No, score=4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Level: **** X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 15:35:04 -0000 --Apple-Mail=_5EF4B912-64F0-46AA-A55B-B6A8CB3854E0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Here is the latest patch after fixing all the nit picks and issues = pointed out by everyone.=20 --Apple-Mail=_5EF4B912-64F0-46AA-A55B-B6A8CB3854E0 Content-Disposition: attachment; filename=call_string.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="call_string.patch" Content-Transfer-Encoding: quoted-printable =46rom=2035786a741f5b7180840fb098fc5643b6018b0050=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Ankur=20Saini=20=0A= Date:=20Sun,=2025=20Jul=202021=2014:47:53=20+0530=0ASubject:=20[PATCH]=20= 2021-07-25=20=20Ankur=20Saini=20=20=0A=0A= gcc/analyzer/ChangeLog:=0A=09*=20call-string.cc=20= (call_string::element_t::operator=3D=3D):=20New=20operator.=0A=09= (call_String::element_t::operator!=3D):=20New=20operator.=0A=09= (call_string::element_t::get_caller_function):=20New=20function.=0A=09= (call_string::element_t::get_callee_function):=20New=20function.=0A=09= (call_string::call_string):=20Refactor=20to=20Initialise=20m_elements.=0A= =09(call_string::operator=3D):=20Refactor=20to=20work=20with=20= m_elements.=0A=09(call_string::operator=3D=3D):=20Likewise.=0A=09= (call_string::to_json):=20Likewise.=0A=09(call_string::hash):=20Refactor=20= to=20hash=20e.m_caller.=0A=09(call_string::push_call):=20Refactor=20to=20= work=20with=20m_elements.=0A=09(call_string::push_call):=20New=20= overload=20to=20push=20call=20via=20supernodes.=0A=09(call_string::pop):=20= Refactor=20to=20work=20with=20m_elements.=0A=09= (call_string::calc_recursion_depth):=20Likewise.=0A=09= (call_string::cmp):=20Likewise.=0A=09(call_string::validate):=20= Likewise.=0A=09(call_string::operator[]):=20Likewise.=0A=09*=20= call-string.h=20(class=20supernode):=20New=20forward=20decl.=0A=09= (struct=20call_string::element_t):=20New=20struct.=0A=09= (call_string::call_string):=20Refactor=20to=20initialise=20m_elements.=0A= =09(call_string::bool=20empty_p):=20Refactor=20to=20work=20with=20= m_elements.=0A=09(call_string::get_callee_node):=20New=20decl.=0A=09= (call_string::get_caller_node):=20New=20decl.=0A=09(m_elements):=20= Replaces=20m_return_edges.=0A=09*=20program-point.cc=20= (program_point::get_function_at_depth):=20Refactor=20to=0A=09work=20with=20= new=20call-string=20format.=0A=09(program_point::validate):=20Likewise.=0A= =09(program_point::on_edge):=20Likewise.=0A---=0A=20= gcc/analyzer/call-string.cc=20=20=20|=20143=20= +++++++++++++++++++++++++---------=0A=20gcc/analyzer/call-string.h=20=20=20= =20|=20=2052=20++++++++++---=0A=20gcc/analyzer/program-point.cc=20|=20=20= 10=20++-=0A=203=20files=20changed,=20154=20insertions(+),=2051=20= deletions(-)=0A=0Adiff=20--git=20a/gcc/analyzer/call-string.cc=20= b/gcc/analyzer/call-string.cc=0Aindex=209f4f77ab3a9..1e652a08a5a=20= 100644=0A---=20a/gcc/analyzer/call-string.cc=0A+++=20= b/gcc/analyzer/call-string.cc=0A@@=20-45,13=20+45,42=20@@=20along=20with=20= GCC;=20see=20the=20file=20COPYING3.=20=20If=20not=20see=0A=20=0A=20/*=20= class=20call_string.=20=20*/=0A=20=0A+/*=20struct=20= call_string::element_t.=20=20*/=0A+=0A+/*=20call_string::element_t's=20= equality=20operator.=20=20*/=0A+=0A+bool=0A= +call_string::element_t::operator=3D=3D=20(const=20= call_string::element_t=20&other)=20const=0A+{=0A+=20=20return=20= (m_caller=20=3D=3D=20other.m_caller=20&&=20m_callee=20=3D=3D=20= other.m_callee);=0A+}=0A+=0A+/*=20call_string::element_t's=20inequality=20= operator.=20=20*/=0A+bool=0A+call_string::element_t::operator!=3D=20= (const=20call_string::element_t=20&other)=20const=0A+{=0A+=20=20return=20= !(*this=20=3D=3D=20other);=0A+}=0A+=0A+function=20*=0A= +call_string::element_t::get_caller_function=20()=20const=0A+{=0A+=20=20= return=20m_caller->get_function=20();=0A+}=0A+=0A+function=20*=0A= +call_string::element_t::get_callee_function=20()=20const=0A+{=0A+=20=20= return=20m_callee->get_function=20();=0A+}=0A+=0A=20/*=20call_string's=20= copy=20ctor.=20=20*/=0A=20=0A=20call_string::call_string=20(const=20= call_string=20&other)=0A-:=20m_return_edges=20= (other.m_return_edges.length=20())=0A+:=20m_elements=20= (other.m_elements.length=20())=0A=20{=0A-=20=20for=20(const=20= return_superedge=20*e=20:=20other.m_return_edges)=0A-=20=20=20=20= m_return_edges.quick_push=20(e);=0A+=20=20for=20(const=20= call_string::element_t=20&e=20:=20other.m_elements)=0A+=20=20=20=20= m_elements.quick_push=20(e);=0A=20}=0A=20=0A=20/*=20call_string's=20= assignment=20operator.=20=20*/=0A@@=20-60,12=20+89,12=20@@=20= call_string&=0A=20call_string::operator=3D=20(const=20call_string=20= &other)=0A=20{=0A=20=20=20//=20would=20be=20much=20simpler=20if=20we=20= could=20rely=20on=20vec<>=20assignment=20op=0A-=20=20= m_return_edges.truncate=20(0);=0A-=20=20m_return_edges.reserve=20= (other.m_return_edges.length=20(),=20true);=0A-=20=20const=20= return_superedge=20*e;=0A+=20=20m_elements.truncate=20(0);=0A+=20=20= m_elements.reserve=20(other.m_elements.length=20(),=20true);=0A+=20=20= call_string::element_t=20*e;=0A=20=20=20int=20i;=0A-=20=20= FOR_EACH_VEC_ELT=20(other.m_return_edges,=20i,=20e)=0A-=20=20=20=20= m_return_edges.quick_push=20(e);=0A+=20=20FOR_EACH_VEC_ELT=20= (other.m_elements,=20i,=20e)=0A+=20=20=20=20m_elements.quick_push=20= (*e);=0A=20=20=20return=20*this;=0A=20}=0A=20=0A@@=20-74,12=20+103,12=20= @@=20call_string::operator=3D=20(const=20call_string=20&other)=0A=20bool=0A= =20call_string::operator=3D=3D=20(const=20call_string=20&other)=20const=0A= =20{=0A-=20=20if=20(m_return_edges.length=20()=20!=3D=20= other.m_return_edges.length=20())=0A+=20=20if=20(m_elements.length=20()=20= !=3D=20other.m_elements.length=20())=0A=20=20=20=20=20return=20false;=0A= -=20=20const=20return_superedge=20*e;=0A+=20=20call_string::element_t=20= *e;=0A=20=20=20int=20i;=0A-=20=20FOR_EACH_VEC_ELT=20(m_return_edges,=20= i,=20e)=0A-=20=20=20=20if=20(e=20!=3D=20other.m_return_edges[i])=0A+=20=20= FOR_EACH_VEC_ELT=20(m_elements,=20i,=20e)=0A+=20=20=20=20if=20(*e=20!=3D=20= other.m_elements[i])=0A=20=20=20=20=20=20=20return=20false;=0A=20=20=20= return=20true;=0A=20}=0A@@=20-91,15=20+120,15=20@@=20call_string::print=20= (pretty_printer=20*pp)=20const=0A=20{=0A=20=20=20pp_string=20(pp,=20= "[");=0A=20=0A-=20=20const=20return_superedge=20*e;=0A+=20=20= call_string::element_t=20*e;=0A=20=20=20int=20i;=0A-=20=20= FOR_EACH_VEC_ELT=20(m_return_edges,=20i,=20e)=0A+=20=20FOR_EACH_VEC_ELT=20= (m_elements,=20i,=20e)=0A=20=20=20=20=20{=0A=20=20=20=20=20=20=20if=20(i=20= >=200)=0A=20=09pp_string=20(pp,=20",=20");=0A=20=20=20=20=20=20=20= pp_printf=20(pp,=20"(SN:=20%i=20->=20SN:=20%i=20in=20%s)",=0A-=09=09=20= e->m_src->m_index,=20e->m_dest->m_index,=0A-=09=09=20function_name=20= (e->m_dest->m_fun));=0A+=09=09=20e->m_callee->m_index,=20= e->m_caller->m_index,=0A+=09=09=20function_name=20(e->m_caller->m_fun));=0A= =20=20=20=20=20}=0A=20=0A=20=20=20pp_string=20(pp,=20"]");=0A@@=20= -109,22=20+138,22=20@@=20call_string::print=20(pretty_printer=20*pp)=20= const=0A=20=20=20=20[{"src_snode_idx"=20:=20int,=0A=20=20=20=20=20=20= "dst_snode_idx"=20:=20int,=0A=20=20=20=20=20=20"funcname"=20:=20str},=0A= -=20=20=20=20=20...for=20each=20return_superedge=20in=20the=20= callstring].=20=20*/=0A+=20=20=20=20=20...for=20each=20element=20in=20= the=20callstring].=20=20*/=0A=20=0A=20json::value=20*=0A=20= call_string::to_json=20()=20const=0A=20{=0A=20=20=20json::array=20*arr=20= =3D=20new=20json::array=20();=0A=20=0A-=20=20for=20(const=20= return_superedge=20*e=20:=20m_return_edges)=0A+=20=20for=20(const=20= call_string::element_t=20&e=20:=20m_elements)=0A=20=20=20=20=20{=0A=20=20= =20=20=20=20=20json::object=20*e_obj=20=3D=20new=20json::object=20();=0A=20= =20=20=20=20=20=20e_obj->set=20("src_snode_idx",=0A-=09=09=20=20new=20= json::integer_number=20(e->m_src->m_index));=0A+=09=09=20=20new=20= json::integer_number=20(e.m_callee->m_index));=0A=20=20=20=20=20=20=20= e_obj->set=20("dst_snode_idx",=0A-=09=09=20=20new=20json::integer_number=20= (e->m_dest->m_index));=0A+=09=09=20=20new=20json::integer_number=20= (e.m_caller->m_index));=0A=20=20=20=20=20=20=20e_obj->set=20("funcname",=0A= -=09=09=20=20new=20json::string=20(function_name=20(e->m_dest->m_fun)));=0A= +=09=09=20=20new=20json::string=20(function_name=20= (e.m_caller->m_fun)));=0A=20=20=20=20=20=20=20arr->append=20(e_obj);=0A=20= =20=20=20=20}=0A=20=0A@@=20-137,8=20+166,8=20@@=20hashval_t=0A=20= call_string::hash=20()=20const=0A=20{=0A=20=20=20inchash::hash=20hstate;=0A= -=20=20for=20(const=20return_superedge=20*e=20:=20m_return_edges)=0A-=20=20= =20=20hstate.add_ptr=20(e);=0A+=20=20for=20(const=20= call_string::element_t=20&e=20:=20m_elements)=0A+=20=20=20=20= hstate.add_ptr=20(e.m_caller);=0A=20=20=20return=20hstate.end=20();=0A=20= }=0A=20=0A@@=20-152,22=20+181,36=20@@=20call_string::push_call=20(const=20= supergraph=20&sg,=0A=20=20=20gcc_assert=20(call_sedge);=0A=20=20=20const=20= return_superedge=20*return_sedge=20=3D=20call_sedge->get_edge_for_return=20= (sg);=0A=20=20=20gcc_assert=20(return_sedge);=0A-=20=20= m_return_edges.safe_push=20(return_sedge);=0A+=20=20= call_string::element_t=20e=20(return_sedge->m_dest,=20= return_sedge->m_src);=0A+=20=20m_elements.safe_push=20(e);=0A+}=0A+=0A= +void=0A+call_string::push_call=20(const=20supernode=20*caller,=0A+=09=09= =09const=20supernode=20*callee)=0A+{=0A+=20=20call_string::element_t=20e=20= (caller,=20callee);=0A+=20=20m_elements.safe_push=20(e);=0A+}=0A+=0A= +call_string::element_t=0A+call_string::pop=20()=0A+{=0A+=20=20return=20= m_elements.pop();=0A=20}=0A=20=0A=20/*=20Count=20the=20number=20of=20= times=20the=20top-most=20call=20site=20appears=20in=20the=0A=20=20=20=20= stack.=20=20*/=0A-=0A=20int=0A=20call_string::calc_recursion_depth=20()=20= const=0A=20{=0A-=20=20if=20(m_return_edges.is_empty=20())=0A+=20=20if=20= (m_elements.is_empty=20())=0A=20=20=20=20=20return=200;=0A-=20=20const=20= return_superedge=20*top_return_sedge=0A-=20=20=20=20=3D=20= m_return_edges[m_return_edges.length=20()=20-=201];=0A+=20=20const=20= call_string::element_t=20top_return_sedge=20=0A+=20=20=20=20=3D=20= m_elements[m_elements.length=20()=20-=201];=0A=20=0A=20=20=20int=20= result=20=3D=200;=0A-=20=20for=20(const=20return_superedge=20*e=20:=20= m_return_edges)=0A+=20=20for=20(const=20call_string::element_t=20&e=20:=20= m_elements)=0A=20=20=20=20=20if=20(e=20=3D=3D=20top_return_sedge)=0A=20=20= =20=20=20=20=20++result;=0A=20=20=20return=20result;=0A@@=20-201,13=20= +244,15=20@@=20call_string::cmp=20(const=20call_string=20&a,=0A=20=20=20=20= =20=20=20if=20(i=20>=3D=20len_b)=0A=20=09return=20-1;=0A=20=0A-=20=20=20=20= =20=20/*=20Otherwise,=20compare=20the=20edges.=20=20*/=0A-=20=20=20=20=20= =20const=20return_superedge=20*edge_a=20=3D=20a[i];=0A-=20=20=20=20=20=20= const=20return_superedge=20*edge_b=20=3D=20b[i];=0A-=20=20=20=20=20=20= int=20src_cmp=20=3D=20edge_a->m_src->m_index=20-=20= edge_b->m_src->m_index;=0A+=20=20=20=20=20=20/*=20Otherwise,=20compare=20= the=20node=20pairs.=20=20*/=0A+=20=20=20=20=20=20const=20= call_string::element_t=20a_node_pair=20=3D=20a[i];=0A+=20=20=20=20=20=20= const=20call_string::element_t=20b_node_pair=20=3D=20b[i];=0A+=20=20=20=20= =20=20int=20src_cmp=20=0A+=20=20=20=20=20=20=09=3D=20= a_node_pair.m_callee->m_index=20-=20b_node_pair.m_callee->m_index;=0A=20=20= =20=20=20=20=20if=20(src_cmp)=0A=20=09return=20src_cmp;=0A-=20=20=20=20=20= =20int=20dest_cmp=20=3D=20edge_a->m_dest->m_index=20-=20= edge_b->m_dest->m_index;=0A+=20=20=20=20=20=20int=20dest_cmp=20=0A+=20=20= =20=20=20=20=09=3D=20a_node_pair.m_caller->m_index=20-=20= b_node_pair.m_caller->m_index;=0A=20=20=20=20=20=20=20if=20(dest_cmp)=0A=20= =09return=20dest_cmp;=0A=20=20=20=20=20=20=20i++;=0A@@=20-215,6=20= +260,26=20@@=20call_string::cmp=20(const=20call_string=20&a,=0A=20=20=20=20= =20}=0A=20}=0A=20=0A+/*=20Return=20the=20pointer=20to=20callee=20of=20= the=20topmost=20call=20in=20the=20stack,=0A+=20=20=20or=20NULL=20if=20= stack=20is=20empty.=20=20*/=0A+const=20supernode=20*=0A= +call_string::get_callee_node=20()=20const=0A+{=0A+=20=20= if(m_elements.is_empty=20())=0A+=20=20=20=20return=20NULL;=0A+=20=20= return=20m_elements[m_elements.length=20()=20-=201].m_callee;=0A+}=0A+=0A= +/*=20Return=20the=20pointer=20to=20caller=20of=20the=20topmost=20call=20= in=20the=20stack,=0A+=20=20=20or=20NULL=20if=20stack=20is=20empty.=20=20= */=0A+const=20supernode=20*=20=0A+call_string::get_caller_node=20()=20= const=0A+{=0A+=20=20if(m_elements.is_empty=20())=0A+=20=20=20=20return=20= NULL;=0A+=20=20return=20m_elements[m_elements.length=20()=20-=20= 1].m_caller;=0A+}=0A+=0A=20/*=20Assert=20that=20this=20object=20is=20= sane.=20=20*/=0A=20=0A=20void=0A@@=20-226,12=20+291,14=20@@=20= call_string::validate=20()=20const=0A=20#endif=0A=20=0A=20=20=20/*=20= Each=20entry's=20"caller"=20should=20be=20the=20"callee"=20of=20the=20= previous=20entry.=20=20*/=0A-=20=20const=20return_superedge=20*e;=0A+=20=20= call_string::element_t=20*e;=0A=20=20=20int=20i;=0A-=20=20= FOR_EACH_VEC_ELT=20(m_return_edges,=20i,=20e)=0A+=20=20FOR_EACH_VEC_ELT=20= (m_elements,=20i,=20e)=0A=20=20=20=20=20if=20(i=20>=200)=0A-=20=20=20=20=20= =20gcc_assert=20(e->get_caller_function=20()=0A-=09=09=20=20=3D=3D=20= m_return_edges[i=20-=201]->get_callee_function=20());=0A+=20=20=20=20{=0A= +=20=20=20=20=20=20gcc_assert=20(e->get_caller_function=20()=20=3D=3D=20=0A= +=20=20=20=20=20=20=09=09=20=20m_elements[i=20-=201].get_callee_function=20= ());=0A+=20=20=20=20}=0A=20}=0A=20=0A=20#endif=20/*=20#if=20= ENABLE_ANALYZER=20*/=0Adiff=20--git=20a/gcc/analyzer/call-string.h=20= b/gcc/analyzer/call-string.h=0Aindex=207721571ed60..a1ac60db4e9=20100644=0A= ---=20a/gcc/analyzer/call-string.h=0A+++=20b/gcc/analyzer/call-string.h=0A= @@=20-24,22=20+24,48=20@@=20along=20with=20GCC;=20see=20the=20file=20= COPYING3.=20=20If=20not=20see=0A=20namespace=20ana=20{=0A=20=0A=20class=20= supergraph;=0A+class=20supernode;=0A=20class=20call_superedge;=0A=20= class=20return_superedge;=0A=20=0A+=0A=20/*=20A=20string=20of=20= return_superedge=20pointers,=20representing=20a=20call=20stack=0A=20=20=20= =20at=20a=20program=20point.=0A=20=0A=20=20=20=20This=20is=20used=20to=20= ensure=20that=20we=20generate=20interprocedurally=20valid=20paths=0A=20=20= =20=20i.e.=20that=20we=20return=20to=20the=20same=20callsite=20that=20= called=20us.=0A=20=0A-=20=20=20The=20class=20actually=20stores=20the=20= return=20edges,=20rather=20than=20the=20call=20edges,=0A-=20=20=20since=20= that's=20what=20we=20need=20to=20compare=20against.=20=20*/=0A+=20=20=20= The=20class=20stores=20returning=20calls=20(=20which=20may=20be=20= represented=20by=20a=0A+=20=20=20returning=20superedge=20).=20We=20do=20= so=20because=20this=20is=20what=20we=20need=20to=20compare=20=0A+=20=20=20= against.=20=20*/=0A=20=0A=20class=20call_string=0A=20{=0A=20public:=0A-=20= =20call_string=20()=20:=20m_return_edges=20()=20{}=0A+=20=20/*=20A=20= struct=20representing=20an=20element=20in=20the=20call_string.=0A+=0A+=20= =20=20Each=20element=20represents=20a=20path=20from=20m_callee=20to=20= m_caller=20which=20represents=0A+=20=20=20returning=20from=20function.=20= =20*/=0A+=0A+=20=20struct=20element_t=0A+=20=20{=0A+=20=20=20=20= element_t=20(const=20supernode=20*caller,=20const=20supernode=20*callee)=0A= +=20=20=20=20:=20=20m_caller=20(caller),=20m_callee=20(callee)=0A+=20=20=20= =20{=0A+=20=20=20=20}=0A+=0A+=20=20=20=20bool=20operator=3D=3D=20(const=20= element_t=20&other)=20const;=0A+=20=20=20=20bool=20operator!=3D=20(const=20= element_t=20&other)=20const;=0A+=0A+=20=20=20=20/*=20Accessors=20*/=0A+=20= =20=20=20function=20*get_caller_function=20()=20const;=0A+=20=20=20=20= function=20*get_callee_function=20()=20const;=0A+=20=20=20=20=0A+=20=20=20= =20const=20supernode=20*m_caller;=0A+=20=20=20=20const=20supernode=20= *m_callee;=0A+=20=20};=0A+=0A+=20=20call_string=20()=20:=20m_elements=20= ()=20{}=0A=20=20=20call_string=20(const=20call_string=20&other);=0A=20=20= =20call_string&=20operator=3D=20(const=20call_string=20&other);=0A=20=0A= @@=20-51,27=20+77,35=20@@=20public:=0A=20=0A=20=20=20hashval_t=20hash=20= ()=20const;=0A=20=0A-=20=20bool=20empty_p=20()=20const=20{=20return=20= m_return_edges.is_empty=20();=20}=0A+=20=20bool=20empty_p=20()=20const=20= {=20return=20m_elements.is_empty=20();=20}=0A=20=0A=20=20=20void=20= push_call=20(const=20supergraph=20&sg,=0A=20=09=09=20=20const=20= call_superedge=20*sedge);=0A-=20=20const=20return_superedge=20*pop=20()=20= {=20return=20m_return_edges.pop=20();=20}=0A+=0A+=20=20void=20push_call=20= (const=20supernode=20*src,=20=0A+=20=20=20=20const=20supernode=20*dest);=0A= +=0A+=20=20element_t=20pop=20();=0A=20=0A=20=20=20int=20= calc_recursion_depth=20()=20const;=0A=20=0A=20=20=20static=20int=20cmp=20= (const=20call_string=20&a,=0A=20=09=09=20=20const=20call_string=20&b);=0A= =20=0A-=20=20unsigned=20length=20()=20const=20{=20return=20= m_return_edges.length=20();=20}=0A-=20=20const=20return_superedge=20= *operator[]=20(unsigned=20idx)=20const=0A+=20=20/*=20Accessors=20*/=0A+=0A= +=20=20const=20supernode=20*get_callee_node=20()=20const;=0A+=20=20const=20= supernode=20*get_caller_node=20()=20const;=0A+=20=20unsigned=20length=20= ()=20const=20{=20return=20m_elements.length=20();=20}=0A+=20=20element_t=20= operator[]=20(unsigned=20idx)=20const=0A=20=20=20{=0A-=20=20=20=20return=20= m_return_edges[idx];=0A+=20=20=20=20return=20m_elements[idx];=0A=20=20=20= }=0A=20=0A=20=20=20void=20validate=20()=20const;=0A=20=0A=20private:=0A-=20= =20auto_vec=20m_return_edges;=0A+=20=20= auto_vec=20m_elements;=0A=20};=0A=20=0A=20}=20//=20namespace=20= ana=0Adiff=20--git=20a/gcc/analyzer/program-point.cc=20= b/gcc/analyzer/program-point.cc=0Aindex=20d73b6211141..d9f50daeb3c=20= 100644=0A---=20a/gcc/analyzer/program-point.cc=0A+++=20= b/gcc/analyzer/program-point.cc=0A@@=20-350,7=20+350,7=20@@=20= program_point::get_function_at_depth=20(unsigned=20depth)=20const=0A=20=20= =20if=20(depth=20=3D=3D=20m_call_string.length=20())=0A=20=20=20=20=20= return=20m_function_point.get_function=20();=0A=20=20=20else=0A-=20=20=20= =20return=20m_call_string[depth]->get_caller_function=20();=0A+=20=20=20=20= return=20m_call_string[depth].get_caller_function=20();=0A=20}=0A=20=0A=20= /*=20Assert=20that=20this=20object=20is=20sane.=20=20*/=0A@@=20-367,7=20= +367,7=20@@=20program_point::validate=20()=20const=0A=20=20=20/*=20The=20= "callee"=20of=20the=20final=20entry=20in=20the=20callstring=20should=20= be=20the=0A=20=20=20=20=20=20function=20of=20the=20m_function_point.=20=20= */=0A=20=20=20if=20(m_call_string.length=20()=20>=200)=0A-=20=20=20=20= gcc_assert=20(m_call_string[m_call_string.length=20()=20-=20= 1]->get_callee_function=20()=0A+=20=20=20=20gcc_assert=20= (m_call_string[m_call_string.length=20()=20-=201].get_callee_function=20= ()=0A=20=09=09=3D=3D=20get_function=20());=0A=20}=0A=20=0A@@=20-438,8=20= +438,10=20@@=20program_point::on_edge=20(exploded_graph=20&eg,=0A=20=09=20= =20=20=20=20=20logger->log=20("rejecting=20return=20edge:=20empty=20call=20= string");=0A=20=09=20=20=20=20return=20false;=0A=20=09=20=20}=0A-=09= const=20return_superedge=20*top_of_stack=20=3D=20m_call_string.pop=20();=0A= -=09if=20(top_of_stack=20!=3D=20succ)=0A+=09const=20= call_string::element_t=20top_of_stack=20=3D=20m_call_string.pop=20();=0A= +=09call_string::element_t=20current_call_string_element=20= (succ->m_dest,=0A+=09=09=09=09=09=09=09=20=20=20=20succ->m_src);=0A+=09= if=20(top_of_stack=20!=3D=20current_call_string_element)=0A=20=09=20=20{=0A= =20=09=20=20=20=20if=20(logger)=0A=20=09=20=20=20=20=20=20logger->log=20= ("rejecting=20return=20edge:=20return=20to=20wrong=20callsite");=0A--=20=0A= 2.32.0=0A=0A= --Apple-Mail=_5EF4B912-64F0-46AA-A55B-B6A8CB3854E0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Thanks you - Ankur --Apple-Mail=_5EF4B912-64F0-46AA-A55B-B6A8CB3854E0--