This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to the gcc version 2.95.3
- To: gcc-patches at gcc dot gnu dot org
- Subject: Patch to the gcc version 2.95.3
- From: Marcio de Oliveira Buss <ra990898 at ic dot unicamp dot br>
- Date: Thu, 6 Jul 2000 18:05:05 -0300 (EST)
gcc version 2.95.2 presents two bugs in the source code of
the function compute_dominators, located at the file flow.c
I think this patch could be inserted in the version 2.95.3
to correct the problem.
The explanation follows:
The algorithm to compute dominators in the CFG begins its for
loop with the first basic block after the entry block. In the case
of gcc, this is the block 0. In the Muchnick's book page 182 one can
found such algorithm, which begins with the basic block namely 1
because this is its first block after the entry block. But in the
case of gcc, it is not the case.
*** flow.c Wed Aug 4 04:09:48 1999
--- flow2.c Thu Jul 6 17:11:16 2000
***************
*** 4652,4658 ****
while (changed)
{
changed = 0;
! for (bb = 1; bb < n_basic_blocks; bb++)
{
sbitmap_intersect_of_predecessors (temp_bitmap[bb],dominators,
bb, s_preds);
--- 4652,4658 ----
while (changed)
{
changed = 0;
! for (bb = 0; bb < n_basic_blocks; bb++)
{
sbitmap_intersect_of_predecessors (temp_bitmap[bb], dominators,
bb, s_preds);
Also, the block indexed by n_basic_blocks - 1 can only postdominates
itself in the beginning of the computation. But in the actual
implementation, the block 0 is initially marked as post-dominating
the basic block `n_basic_blocks - 1'.
***************
*** 4645,4651 ****
SET_BIT (dominators[0], 0);
sbitmap_zero (post_dominators[n_basic_blocks - 1]);
! SET_BIT (post_dominators[n_basic_blocks - 1], 0);
passes = 0;
changed = 1;
--- 4645,4651 ----
SET_BIT (dominators[0], 0);
sbitmap_zero (post_dominators[n_basic_blocks - 1]);
! SET_BIT (post_dominators[n_basic_blocks - 1], n_basic_block - 1);
passes = 0;
changed = 1;
ChangeLog:
Thu Jul 06 17:57:07 2000 Marcio Buss (marcio.buss@ic.unicamp.br)
* flow.c (compute_dominators) : Starts the algorithm with the
first basic block after the entry block, in the case, 0.
Mark n_basic_blocks-1 as initially postdominating itself.