Uninitialised memory read in gcc-2.95.2/gcc/lcm.c

Martin Stromberg Martin.Stromberg@lu.erisoft.se
Sun Mar 12 04:48:00 GMT 2000


In gcc-2.95.2/lcm.c, around line 499, compute_latein looks like this:

/* Compute latestness.

   From Advanced Compiler Design and Implementation pp412.

   An expression is latest at the entrance to block BB if that is an optimal
   point for computing the expression and if on every path from block BB's
   entrance to the exit block, any optimal computation point for the 
   expression occurs after one of the points at which the expression was
   computed in the original flowgraph.  */

static void
compute_latein (n_blocks, n_exprs, s_succs, antloc, delayin, latein)
     int n_blocks;
     int n_exprs;
     int_list_ptr *s_succs;
     sbitmap *antloc;
     sbitmap *delayin;
     sbitmap *latein;
{
  int bb;
  sbitmap temp_bitmap;

  temp_bitmap = sbitmap_alloc (n_exprs);

  for (bb = 0; bb < n_blocks; bb++)
    {
      /* The last block is succeeded only by the exit block; therefore,
	 temp_bitmap will not be set by the following call!  */
      if (bb == n_blocks - 1)
	{
          sbitmap_intersect_of_successors (temp_bitmap, delayin,
				           bb, s_succs);
	  sbitmap_not (temp_bitmap, temp_bitmap);
	}
      else
	sbitmap_ones (temp_bitmap);
      sbitmap_a_and_b_or_c (latein[bb], delayin[bb], /* This is line 499. */
			    antloc[bb], temp_bitmap);
    }
  free (temp_bitmap);
}

is the else part supposed to look like this:
"else
{
	sbitmap_ones (temp_bitmap);
	sbitmap_a_and_b_or_c (latein[bb], delayin[bb],
				antloc[bb], temp_bitmap);
}"?

If not, then there's a need for "sbitmap_ones (temp_bitmap);" or
"sbitmap_zero (temp_bitmap);" in the if part.


U2, October,

							MartinS


More information about the Gcc-bugs mailing list