sult on a test program. Section 4 concludes the work.
2 BACKGROUND
The algorithm behind our slicing tool is proposed in
(Cortesi and Halder, 2010) that combines the notions
of statement relevancy, semantic data dependences
and conditional dependences. Let us discuss these
three notions and the slicing algorithm in brief.
In traditional Program Dependence Graphs
(PDGs), the notion of dependences between state-
ments is based on the syntactic presence of a variable
in the definition of another variable or in a condi-
tional expression. Therefore, the definition of slices
at semantic level creates a gap between slicing and
dependences. Mastroeni and Zanardini (Mastroeni
and Zanardini, 2008) first introduced the notion
of semantic data dependences which fills up the
existing gap between syntax and semantics. The
semantic data dependences which are computed
for all expressions in the program over the states
possibly reaching the associated program points,
help in obtaining more precise semantics-based
PDGs by removing some false dependences from the
traditional syntactic PDGs. For instance, although
the expression “e = x
2
+ 4w mod 2 + z” syntactically
depends on w, but semantically there is no depen-
dence as the evaluation of “4w mod 2” is always zero.
This can also be lifted to an abstract setting where
dependences are computed with respect to some
specific properties of interest rather than the concrete
values. For instance, if we consider the abstract
domain SIGN={>, pos, neg, ⊥}, the expression e
does not semantically depend on x w.r.t. SIGN, as
the abstract evaluation of x
2
always yields to pos for
all atomic values of x ∈ {pos, neg}. This is the basis
to design abstract semantics-based slicing algorithms
aimed at identifying the part of the programs which
is relevant with respect to a property (not necessarily
the exact values) of the variables at a given program
point.
Sukumaran et al. (Sukumaran et al., 2010) pre-
sented a refinement of the traditional PDGs into De-
pendence Condition Graphs (DCGs) based on the no-
tion of conditional dependences. A DCG is built from
the PDG by annotating each edge e = e.src → e.tgt
in the PDG with information e
b
= he
R
, e
A
i that cap-
tures the conditions under which the dependence rep-
resented by that edge is manifest. The first compo-
nent e
R
refers to Reach Sequences, whereas the sec-
ond component e
A
refers to Avoid Sequences. The
informal interpretation of e
R
is that the conditions
represented by it should be true for an execution to
ensure that e.tgt is reached from e.src. The Avoid
Sequences e
A
captures the possible conditions under
which the assignment at e.src can get over-written be-
fore it reaches e.tgt. The interpretation of e
A
is that
the conditions represented by it must not hold in an
execution to ensure that the variable being assigned at
e.src is used at e.tgt. It is worthwhile to note that e
A
is relevant only for DDG edges and it is
/
0 for CDG
edges.
Cortesi and Halder (Cortesi and Halder, 2010) ap-
plied the notion of semantic relevancy of statements.
It determines whether an imperative statement is rele-
vant w.r.t. a property of interest, and is computed over
all concrete (or abstract) states possibly reaching the
statement. For instance, consider the following code
fragment: {(1) x = input; (2) x = x+2; (3) print x;}.
If we consider an abstract domain of parity repre-
sented by PAR={>, odd, even, ⊥}, we see that the
variable x at program point 1 may have any parity
from the set {odd, even}, and the execution of the
statement at program point 2 does not change the par-
ity of x at all. Therefore, the statement at 2 is seman-
tically irrelevant w.r.t. PAR. By disregarding all the
nodes that correspond to irrelevant statements w.r.t.
concrete (or abstract) property from a syntax-based
PDG, we obtain a more precise semantics-based (ab-
stract) PDG.
The combined effort of semantic relevancy of
statements with the expression-level semantic data
dependences by Mastroeni and Zanardini (Mastroeni
and Zanardini, 2008) guarantees a more precise
semantics-based (abstract) PDG. A further refinement
of it can be achieved by applying the notion of condi-
tional dependences by Sukumaran et al. (Sukumaran
et al., 2010) that allows us to transform PDGs into
DCGs and to identify unrealizable dependneces in
them under the trace semantics of the programs. The
removal of such unrealizable dependences yields to
more refined semantics-based (abstract) DCGs.
The slicing algorithm GEN-SLICE makes use of
two auxiliary algorithms. Given a program P and an
abstract domain ρ, the algorithm REFINE-PDG gen-
erates semantics-based abstract PDG w.r.t. ρ. The
algorithm REFINE-DCG converts the PDG (which
is refined by the algorithm REFINE-PDG) into a
DCG by computing the annotation over all depen-
dence edges, and then again refines it into more pre-
cise one by removing some unrealizable dependence
paths. Finally, GEN-SLICE performs slicing based
on the dependence graphs obtained this way.
Tukra:AnAbstractProgramSlicingTool
179