Software has been under scrutiny by the verification community from various angles in the recent past. There are two major algorithmic approaches to ensure the correctness of and to eliminate bugs from such systems: software model checking and static analy
TheatomicpropositionsthatareusedaslabelsontheCFGaregenerated,asmentionedbefore,intwosteps.Inthecaseofuninitializedvariableanalysis,theprocedurein-troducesthreelabelsforeachvariable.E.g.,thedeclarationofvariableainline2ofthecodefragment,forexample,leadstotheintroductionofthelabels:decla,usedaandassigneda.Eachoftheselabelswillbeanatomicproposi-tioninthemodelcheckingframework.
Next,wedescribetheassociatedtreepatternsforeachproposition.Propositiondecla,usedtolabeldeclarationsofvariablea,isassociatedwithpattern↓ Decl[Var:a].Onlynode26intheCFGmatchesthispattern,correspondingtothedeclarationinline2ofthesourcecode,andwillbela-belleddecla.
Propositionusedawilllabelnodesthatusethevari-ablea.Thesearenodeswhichareeither(i)labelledPlus,PostincorPreinc,andhaveachildlabelledVar:a,or(ii)nodeslabeledModifwitharighthand-sidechildVar:a.
Thecorresponding patternis↓(Plus∪Postinc∪Preinc∪...)[Var:a]↓Modif[Var:a[attr=”rhs”]].Node98inFigure3(a)matchesthispattern.However,thisnodeisnotpartoftheCFG.Hence,webacktracktothenearestances-torwhichispartoftheCFG,inthiscasenode72,andlabelituseda.Node72correspondstoline11inthecodefrag-ment.
Finally,forpropositionassignedawelookfornodesthatmodifyavariablewhichhavelabelssuchasModif,PostincorPreincandaleft-hand-sidesuccessorVar:a.Thiscorrespondstothepattern↓ (Modif∪Postinc∪Preinc)[Var:a[attr=”lhs”]].Node86willbelabeledassigneda,becauseitisthenearestancestorofanodethatmatchesthispattern.ThedescribedprocessresultsinthelabelledCFGdepictedinFigure3(b).
MODULEmain
VARlocation:{loc26,loc34,...,loc12}next(location)case
location=location=...
location=...esac
:=
loc26:{loc34};loc34:{loc39};
loc63:{loc78,loc72};
DEFINE
decla:=locationin{loc26};useda:=locationin{loc86};assigna:=locationin{loc72};SPECAGdecla=>(A usedaWassigna)
Figure4.NuSMVcode(fragment)
onwhichaisused,butnotassignedanyvaluebe-forehand.TheprototypetoolGoannawillwarntheuserwith:“Warning:Variable‘a’mightbeuninitialized”andautomaticallyproducesacoun-terexamplewiththesequenceoflinenumbers2,3,5,6,7,11.Notethatthisanalysispointstoapotentialbug.Thereareotherpropertiesthat,ifviolated,pointtode nitebugs.
搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新高等教育F. Model checking software at compile time(9)全文阅读和word下载服务。
相关推荐: