Shape analysis through predicate abstraction and model check(10)

2021-04-05 08:20

Abstract. We propose a new framework, based on predicate abstraction and model checking, for shape analysis of programs. Shape analysis is used to statically collect information — such as possible reachability and sharing — about program stores. Rather t

ande2withtypest1andt2resp.Thispropertyallowsthesimpli ertoreplaceapredicateoftheformreach[A;F](e1,e2)byfalseiftypreach[F](t1,t2)failstohold.(Otherwise,nothingisreplaced.)Typereasoningisalsousedtosimplifyequalities;e.g.(x==y)isfalseifthetypesofxandydi er.

5AnExample

Weillustrateourapproachonaprogramforin-placereversalofsingly-linkedlists,alsoconsideredine.g.[4,24,33,28,29].ThecoreoftheprogramisgiveninFigure6.

Listx,y,t;/*xisanacycliclist*/

n1:y=NULL;

n2:while(x!=NULL){

n3:t=y;

n4:y=x;

n5:x=x->n;

n6:y->n=NULL;

n7:y->n=t;};

n8:

Fig.6.Thelistreversalprogram

Initially,xisthelisttobereversed.Itistraversedheadtotail,reversingthenext-pointers(n)onebyone.Atthestartofeveryiterationofthewhileloop,xistherestofthelisttobereversedandyistheinitialsegmentthathasbeenreversedsofar.Variabletisauxiliary;atanypointduringthereversal,itpointstooneofthe ingshapeanalysis,wewanttoverifythatyisanacycliclistafterthereversal(usingthenegationofpredicatep1=cyclic[;n]y@n8),giventhepreconditionthatxisacyclic(p2=cyclic[;n]x@n1).

Werunourtoolon(the ow-chartdescriptionof)theprogramtogetherwithpredicatesp1andp2,butwithoutanyapproximation.Bychoosingarelativelylargeiterationbound,predicatesaregeneratedthatoccurinwp’sobtainedbypropagatingp1backwardsthroughthesequenceofstatementsofthewhileloopforaseveraliterations(p2,beingatn1,doesnotgenerateanynewpredicates).Bymanuallyinspectingthesepredicates,wecangetanideaoftheappropriateapproximationstobeapplied.Settingtheiterationboundto30,185predi-cate/locationpairsarecalculatedcorrespondingtoabout3backwarditerationsthroughthewhileloop.Allpredicatesareoftypecyclic,reach,orequality;theydi erintheirarguments.Thefollowingisanexcerptfromthetool’soutput,showingsomepredicatesrelevantatlocationn5.


Shape analysis through predicate abstraction and model check(10).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:免疫缺陷病的共同临床特点是

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: