Analytical Techniques - Static Analysis - Data Flow Analysis

6 important questions on Analytical Techniques - Static Analysis - Data Flow Analysis

What;s data flow analysis?

Data flow analysis covers a variety of techniques which gather information about the use of variables in a system.
The lifecycle of each variable is investigated, (i.e., where it is declared, defined, read, evaluated and destroyed), since anomalies can occur during any of those operations or if the operations are out of sequence.

Name a data flow analysis technique and how does it work?

Definition-use notation, where the lifecycle of each variable is split into three different atomic actions:

  • d: when the variable is declared, defined or initialized
  • u: when the variable is used or read in either a computation or a decision predicate
  • • k: when the variable is killed, destroyed or goes out of scope

What's an alternative for the data flow technique definition-use notation?

A common alternative notation for d-u-k is: d (define) - r (reference or read) - u (undefine).
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

How do you use the three atomic actions in data flow analysis?

The three atomic actions are combined into pairs (“definition-use pairs”) to illustrate the data flow. For example, a "du-path" represents a fragment of the code where a data variable is defined and then subsequently used.

Name a few anomalies which can be used while performing a correct action at the wrong time or carrying out an incorrect action on data in a variable.

  • Failing to assign a value to a variable before using it
  • Taking an incorrect path due to an incorrect value in a control predicate
  • Trying to use a variable after it is destroyed
  • Referencing a variable when it is out of scope
  • Declaring and destroying a variable without using it
  • Redefining a variable before it has been used
  • Failing to kill a dynamically allocated variable (causing a possible memory leak)
  • Modifying a variable, which results in unexpected side effects (e.g., ripple effects when changing a global variable without considering all uses of the variable)

What's the disadvantage of data flow analysis?

It may miss some issues that occur as data is used in the runtime system.
For example, the static data variable may contain a pointer into a dynamically created array that does not even exist until runtime. Multi-processor usage and pre-emptive multi-tasking may create race conditions which will not be found by data flow or control flow analysis

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo