A method for intra-procedural data flow anomaly auto-detection facing to inspection
Bian Lei,Liu Chao,Jin Mao-Zhong
2010-01-01
Abstract:Code inspection plays an important role in constructing the quality of software product,but inspection wastes time and human resource,and needs assistant with some automated tools. Data flow anomalies is that the variable is used incorrectly in the code,and it means that there are potential errors in the code. Data flow anomalies is an important type of defects in the check list which is used during inspection,and it is also mainly focus on during inspection. Based on a review of data flow anomalies,the defects that relates with data flow anomalies can be found before running the program,and effectively improve software quality and reduce the cost of solving the software problems. Data flow anomaly should be inspected carefully during inspection,this paper issues a method for intra-procedural data flow anomaly auto-detection basing on finite automaton.First,data flow and variables in a program are closely related,there are three different kinds of method to use a variable:define,refer and kill. When the variables are used incorrectly,there are six types of data flow anomaly.Second,when the data flow anomalies in a code fragment are auto-reviewed,the code is analyzed statically and the abstract syntax tree of the code can be got. After that,from the syntax tree,there are some different logical paths that are made up of the statements in the code fragment,some of which are using variable.Finally,a finite automaton (Mealy) with four different states that is used to represent how a variable on the logical path is used is build. The automaton's input is the method with that the statement uses variable on the logical path and its output is whether the data flow anomaly exists. The state of the automaton will transfer if there are some inputs,and by the transition of the states,intra-procedural data flow anomaly should be found.The method introduced in the paper is language independent,faces to inspection,and improves the efficiency of Data flow anomaly detection and code inspection.