Program slicing using weakest preconditions

  • Joseph J. Comuzzi
  • Johnson M. Hart
Session 8: Testing and Debugging
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1051)


Program slices have long been used as an aid to program understanding, especially in maintenance activities. Most slicing methods involve data and control flow analysis to determine what statements might affect a set of variables. Here, we develop a more precise slicing concept, called p-slices, defined using Dijkstra's weakest precondition (wp), to determine which statements will affect a specified predicate. Weakest preconditions are already known to be an effective technique for program understanding and analysis, and this paper unifies wp analysis and slicing and simplifies existing slicing algorithms. Slicing rules for assignment, conditional, and repetition statements are developed. The authors are currently using these techniques in their work with software maintenance teams and are incorporating p-slice computation into a program analysis tool.


Formal Method Repetition Statement Safety Property Code Fragment Software Maintenance 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Aho, Sethi & Ullman, Compilers: Principles, Techniques, and Tools. Addison-Wesley, 1986.Google Scholar
  2. 2.
    A. Bijlsma, “Calculating with pointers,” Sci. Comput. Programming, vol. 12, pp. 191–205, 1989.Google Scholar
  3. 3.
    E. Cohen, Programming in the 1990s. NY: Springer-Verlag, 1990.Google Scholar
  4. 4.
    E. W. Dijkstra, A Discipline of Programming. Englewood Cliffs, NJ: Prentice-Hall, 1976.Google Scholar
  5. 5.
    E.W. Dijkstra and C.S. Scholten, Predicate Calculus and Program Semantics. NY: Springer-Verlag, 1989.Google Scholar
  6. 6.
    K. B. Gallagher and J. R. Lyle, “Program slicing in software maintenance,” IEEE Trans. Software Eng., vol. 17, no. 8, Aug. 1991.Google Scholar
  7. 7.
    D. Gries, The Science of Programming. NY: Springer-Verlag, 1981.Google Scholar
  8. 8.
    J. M. Hart, “Experience with logical code analysis in software reuse and reengineering,” in AIAA Computing in Aerospace 10 (San Antonio, TX), Mar. 28–30, 1995, pp. 549–558.Google Scholar
  9. 9.
    J. M. Hart, “Experience with logical code analysis in software maintenance,” Software Practice and Experience, vol. 25, no. 11, pp. 1243–1262, 1995.Google Scholar
  10. 10.
    B. Kernighan and D. Ritchie, The C Programming Language. Englewood Cliffs, NJ: Prentice-Hall, 1978.Google Scholar
  11. 11.
    P. E. Livadas and S. Croll, “A new algorithm for the calculation of transitive dependencies,” Software Maintenance: Research and Practice, vol. 7, pp. 151–176, May–June 1995.Google Scholar
  12. 12.
    Z. Manna and R. Waldinger, “Problematic features of programming languages: A situational-calculus approach,” Acta Informatica, vol. 16, pp. 371–426, 1981.Google Scholar
  13. 13.
    M. Weiser, “Programmers use slices when debugging,” Commun. Assoc. Comput. Mach., vol. 25, pp. 446–452, July 1982.Google Scholar
  14. 14.
    M. Weiser, “Program slicing,” IEEE Trans. Software Eng., vol. SE-10, pp. 352–357, July 1984.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Joseph J. Comuzzi
    • 1
  • Johnson M. Hart
    • 1
  1. 1.Peritus Software Services, Inc.BillericaUSA

Personalised recommendations