Method for detecting redundant code defects based on static analysis

A defect detection and redundant code technology, applied in the field of redundant code detection

Inactive Publication Date: 2011-11-02
HARBIN INST OF TECH
View PDF1 Cites 36 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Due to the lack of attention to redundant code and related defects, there is currently a lack of mature detection methods for redundant code and related defects

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for detecting redundant code defects based on static analysis
  • Method for detecting redundant code defects based on static analysis
  • Method for detecting redundant code defects based on static analysis

Examples

Experimental program
Comparison scheme
Effect test

specific Embodiment approach 1

[0016] Specific implementation mode one: combine figure 1 Describe this implementation mode, the concrete steps that this implementation mode comprises are as follows:

[0017] Step 1: Input the program to be tested and parse it into an abstract syntax tree;

[0018] Step 2: Analyze statements that may contain explicit idempotent operations, and detect explicit idempotent operations: traverse the abstract syntax tree of the program, process specific types of abstract syntax tree subtrees that may contain idempotent operations, and determine whether there are defects ;

[0019] Step 3: For locally defined variables, use the process internal analysis method to detect redundant assignment statements: on the basis of the abstract syntax tree, track each assigned variable, if it is not assigned before the end of the function or before it is reassigned use, it is judged as a defect;

[0020] Step 4: traverse the abstract syntax tree of the program, create a corresponding Program ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a method for detecting redundant code defects based on static analysis, for solving the problem lacking of a mature method for detecting redundant codes and related defects currently. The method comprises the following steps of: 1, inputting a program to be tested; analyzing the program into an abstract syntax tree; 2, analyzing statements possibly including operations of explicit power and the like; detecting the operations of the explicit power and the like; 3, for locally defined variables, detecting redundant assignment statements by using an internal process analysis method; 4, traversing the abstract syntax tree of the program; searching structures including the defects on the basis of a standardized program dependency graph; detecting dead codes; 5, detecting redundant conditional expressions; 6, detecting operations of implicit power and the like; and 7, detecting redundant function parameters; and giving a defect detection report according to the six defect detection results obtained in the steps 2-7. The method disclosed by the invention is applicable for analyzing large-scale program codes.

Description

technical field [0001] The invention relates to a computer program analysis technology and a computer software code detection method, in particular to a redundant code detection method. Background technique [0002] Redundant code defect detection is an important task in computer software development and maintenance activities, and it is widely used in many fields such as software maintenance, software defect detection, and program understanding. [0003] There are usually two situations for redundant code in a program, one is reachable, such as explicit idempotent operations, implicit idempotent operations, redundant assignment statements, redundant function parameters, etc., and the other is unreachable , such as dead code, redundant conditional expressions, etc. Redundant codes not only affect the test evaluation and operation efficiency of software, but also have potential safety hazards, and thus cause semantic and logical defects, which are difficult to be detected by...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/36
Inventor 苏小红马培军王甜甜龚丹丹逄龙
Owner HARBIN INST OF TECH
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products