What is Information Flow Analysis?
Information Flow Analysis, also called variable dependency analysis, is a
study of the interdependencies of the program variables. LDRA Testbed analyses these
dependencies on a procedure-by-procedure basis.
Information Flow Analysis Example
A variable A is said to depend on another variable B in a procedure if
there is a path such that the value of B can cause the value of A to change. Intermediate
variables do not appear in lists of dependencies. Only input variables appear in such
lists. For example, if variable B is an intermediate variable which depends on C as in:
B := C; A := B;
then variable A depends on C (and not on B). Different types of
dependency are distinguished:
Strongly dependent: If a variable A is defined then it always
depends on the variable B, i.e. the value of A depends on B for every path containing
an assignment to A in the procedure. Such as:
A = B + 1
Weakly dependent: The variable A sometimes depends on the variable B, i.e.
there is at least one path through the procedure on which A is defined with reference to B,
and there is another path where A is defined without reference to B.
Such as:
if (condition) A = B + 1
Conditionally dependent: The variable A does not directly depend
on the variable B, but the value of the variable B does influence the value of A by changing
the control flow paths. Such as:
if (B > 0) A = 0
Additionally, two types of definition can be identified:
Strongly defined: A variable is strongly defined if it always
acquires a value, i.e. the variable's value is computed on every path through the
procedure.
Weakly defined: A variable is weakly defined if it may
acquire a value, i.e. the variable is therefore not computed on at least one path
through the procedure.
Where users know what the dependencies should be they can insert
this information into their code by means of a comment such as (for Ada):
--LDRA_INFOFLOW < output variable >[text]([< input variable > {,< input variable >}])
where < output variable > is the name of an output variable, [text]
is commentary and < input variable > is the name of an input variable on which the
output variable depends. If the comment takes up more than one line then the second
and subsequent lines must also be legal comments, i.e. for Ada, start with --.
For example:
--LDRA_INFOFLOW xi (a,b,c)
--LDRA_INFOFLOW hiy depends on (y,z)
--LDRA_INFOFLOW DGSZ ( )
--LDRA_INFOFLOW G5Y depends on (P,Q,R)
--LDRA_INFOFLOW MANY depends on (ONE,TWO,
--THREE,FOUR)
LDRA Testbed compares this predicted dependency with the actual
dependency and reports the results in the Information Flow Analysis Report. In order
to make the previous ideas more explicit, consider the following code:

Example Code for Information Flow Analysis
Dead statements, i.e. statements which do not contribute to output
values are reported, so the corresponding Information Flow Analysis would yield:

Information Flow Analysis Results for the sample code featured above.
Obtaining Further Information
For further information on this particular feature of TBsafe and its availability please complete the LDRA reply form or email .
|