We notice that the value of variable x in the segment's last two lines is the constant number 7. This is always true, because of the assignment to x in the segment's first line. Therefore, the two instances of x can be substituted by the constant value 7 (this value propagates through the next two lines). The reduced source program is the following:
x = 7;
y = 2 * x;
z = f (x, y);
x = 7;
y = 2 * 7;
z = f (7, y);
However, let us not overlook that when programmers debug a program, they usually start by trying to reproduce the bug for a particular test case, and therefore for a particular set of constant values for program variables. The general source program does not look at all like the oversimplified example presented above. However, the programmer only has to debug the specific program corresponding to the test case that produces the bug. In this program the values of several variables are constant and known and the program itself does not differ much from our example.
This page is maintained by Nikos Papaspyrou.
Last updated: Monday May 15 1995, 12:05 EET DST.