Computer Languages, Systems & Structures 36 (2010) 96 -- 121 Contents lists available at ScienceDirect Computer Languages, Systems & Structures journal homepage: www.elsevier.com/locate/cl The dependence condition graph: Precise conditions for dependence between program points Srihari Sukumaran a, , Ashok Sreenivas b , Ravindra Metta c a Philips Research Asia, Bangalore, India b Independent Software Consultant, India c Tata Research Design and Development Centre, India ARTICLE INFO ABSTRACT Article history: Received 15 May 2007 Received in revised form 9 March 2009 Accepted 17 April 2009 Keywords: Program dependence Software engineering Program dependence graph (PDG) Static analysis The problem of identifying the conditions under which semantic or behavioural dependences arise between different program statements has interesting applications in various areas such as program understanding, software maintenance, software audits and software testing. We present an extension to the program dependence graph (PDG), called the dependence condition graph (DCG), that enables identifying the conditions for dependence between program points. We show that these conditions are not only correct with respect to the program's semantics, but also more precise than identified by other known techniques. We also present evidence that the DCG is a practical representation and can be built for large programs, and sketch many different applications of the DCG. © 2009 Elsevier Ltd. All rights reserved. 1. Introduction We present an extension of the classical program dependence graph (PDG) [1–3] called the dependence condition graph (DCG). The DCG is obtained by adding to each PDG edge an annotation whose semantic interpretation encodes the condition under which the dependence represented by that PDG edge actually arises in a program execution. This semantic interpretation can be naturally extended to PDG paths and sets of PDG paths. It also enables us to define a condition AC(s, t) for checking the presence of semantic dependence of statement t on statement s. AC is sound and also more precise than those identified by other known techniques. 1 The DCG annotations themselves and their semantic interpretation can be used in many applications such as test generation, instrumentation and impact analysis in software maintenance. The important features of the DCG are: The DCG is easy and efficient to construct (Sections 4 and 6), and has a well-defined semantics consistent with the program's execution semantics (Section 7). Most of the work described in this article was done when the first two authors were at Tata Research Design and Development Centre (TRDDC), 54B Hadapsar Industrial Estate, Pune 411013, India. Corresponding author. Currently at: General Motors India Science Lab, General Motors India Pvt Ltd, Floor 3, Creator Building, ITPB, Whitefield Road, Bangalore 560066, India. Tel.: +91 80 41184126; fax: +91 80 41158562. E-mail addresses: srihari.sukumaran@gm.com, srihari.sukumaran@gmail.com (S. Sukumaran), ashok.sreenivas@gmail.com (A. Sreenivas), r.metta@tcs.com (R. Metta). 1 It is well known that semantic dependence is uncomputable [4]. A condition for semantic dependence is sound when, if it returns false then it is certain that there is no semantic dependence. Naturally this is desired of any condition. A more precise condition produces fewer false positives. 1477-8424/$ - see front matter © 2009 Elsevier Ltd. All rights reserved. doi:10.1016/j.cl.2009.04.001