Applications of Data-Flow Analysis

  1. optimization
  2. correctness


Some optimization examples:

  • common subexpression elimination using available expression analysis
    • avoid recomputing (automatically or manually generated) identical expressions
  • constant propagation
    • use constants instead of variables if variable value is known
  • copy propagation
    • use another variable with the same name
  • dead code elimination
    • remove unnecessary code
  • automatically generate code for parallel machines

Consider code:

  c =;

  x = complexComputationF(a.f,b.g);
  y = complexComputationG(c.f,d.g);
  z = x + y;
  c.f = e;
  u = complexComputationF(a.f,b.g);


  • can we compute complexComputationF and complexComputationG in parallel?
  • does u compute same results as x ?
  • what areas of memory do functions
    • read
    • write
  • can a and c both refer to the same object?
    • alias analysis



Perform various partial correctness checks:

  • initialization analysis
  • protocol usage analysis
  • array bounds checks
  • absence of memory errors

Slides Illustrating Past Disasters

Software is used safety-critical systems (airplanes, cars, submarines). The consequences of errors are more severe than on desktops, so correctness standards must be higher. At the same time, complexity of systems bugs are more and more likely. In absence of automated tool support, disasters will happen. Here are examples of disasters:

Large commercial losses:

  • Pentium bugs encouraged hardware industry to embrace verification
  • Millions of bank accounts were impacted by errors due to installation of inadequately tested software code in the transaction processing system of a major North American bank, according to mid-2004 news reports. Articles about the incident stated that it took two weeks to fix all the resulting errors, that additional problems resulted when the incident drew a large number of e-mail phishing attacks against the bank's customers, and that the total cost of the incident could exceed $100 million.

For many more examples, see

ASTREE Analyzer

“In Nov. 2003, ASTRÉE was able to prove completely automatically the absence of any run-time error in the primary flight control software of the Airbus A340 fly-by-wire system, a program of 132,000 lines of C analyzed in 1h20 on a 2.8 GHz 32-bit PC using 300 Mb of memory (and 50mn on a 64-bit AMD Athlon™ 64 using 580 Mb of memory).”

Some Commercial Tools

  • Coverity Prevent SAN FRANCISCO - January 8, 2008 - Coverity®, Inc., the leader in improving software quality and security, today announced that as a result of its contract with US Department of Homeland Security (DHS), potential security and quality defects in 11 popular open source software projects were identified and fixed. The 11 projects are Amanda, NTP, OpenPAM, OpenVPN, Overdose, Perl, PHP, Postfix, Python, Samba, and TCL.
    • recently: bugs in Android kernel