Font Size: a A A

Research On Detection Of Redundancies And Related Software Defects Of C Programs

Posted on:2011-08-04Degree:MasterType:Thesis
Country:ChinaCandidate:W WangFull Text:PDF
GTID:2178330338979969Subject:Computer Science and Technology
Abstract/Summary:PDF Full Text Request
With the increasing of software scale, detection of software defects becomes more and more important. A little bug may cause great loss. But for a long time, as the redundant code was considered not to do harm to software severely, so its existence was always neglected and attracted little attention. But the facts show that some bugs in redundant code also did serious harm to software quality like some other bugs. And these bugs was difficult to found.According to present situation, we propose a model of detection of redundancies and related software defects of C programs. Around the model, this paper introduces some related technologies, including program static analysis, lexical analysis and syntax parser, parser tree and program dependence graph, so as to understand the model better. The model proposed in this paper can detect four kinds of redundant defects: idempotent operations, redundant assignments, dead code and redundant conditionals.The basic idea of the model is: firstly, preprocess the C program, then do lexical analysis, transform the source code into token string and do struct and typedef identifiers analysis on the token string. Based on the above two steps, generate parser tree and on which do four kinds of detection of defects related to redundant code: 1) analyze the subtree that contains idempotent operations to find idempotent operations; 2) for local variables, use a intraprocedural analysis to find redundant assignment; 3) generate PDG from the parser tree and analyze the structure of the PDG to find dead code; 4) do data flow analysis to calculate values of assignment expression and conditional expression to find redundant conditionals. Finally, display the detection results.The model is tested with open source codes and detects some real defects. This helps to improve these open source project. And we do some emulate experiments with the model. The above experimental results show that the model in this paper can find four kinds of defects related to redundant code efficiently. It is very convenient to do detection and correction of this kind of defects for developer and further guarantees the software quality.
Keywords/Search Tags:redundant code, program static analysis, program dependence graph, parser tree, detection of software defects
PDF Full Text Request
Related items