dead code removal in flow.c cleanup

Jan Hubicka jh@suse.cz
Mon Mar 18 12:09:00 GMT 2002


>  > From: Jan Hubicka <jh@suse.cz>
>  > 
>  > > Jan,
>  > > 
>  > >  > flow.c:764: warning: `ndead' might be used uninitialized in this function
>  > > 
>  > > If you look at the code in question in the function
>  > > update_life_info_in_dirty_blocks, `ndead' is clearly uninitialized if
>  > > and when (n==0).  I don't know if that's ever possible, but if it is
>  > > then the function returns (ndead == unitialized garbage).
>  > > 
>  > > Would you please take a look and take steps to remove the warning?
>  > 
>  > Oops, I already fixed that in my tree and somehow forgot to push it into
>  > the tree.  I will do so ASAP.
>  > Honza
> 
> Great, thanks!
I am going to check in the attached patch as obvious to fix both problems.
Bootstrapped/regtested i386.

Mon Mar 18 21:06:40 CET 2002  Jan Hubicka  <jh@suse.cz>
	* flow.c (update_life_info_in_dirty_blocks): Fix uninitialized
	variable.

Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.509
diff -c -3 -p -r1.509 flow.c
*** flow.c	2002/03/08 17:34:00	1.509
--- flow.c	2002/03/18 19:50:00
*************** update_life_info_in_dirty_blocks (extent
*** 761,767 ****
    sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks);
    int block_num;
    int n = 0;
!   int ndead;
  
    sbitmap_zero (update_life_blocks);
    for (block_num = 0; block_num < n_basic_blocks; block_num++)
--- 761,767 ----
    sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks);
    int block_num;
    int n = 0;
!   int retval = 0;
  
    sbitmap_zero (update_life_blocks);
    for (block_num = 0; block_num < n_basic_blocks; block_num++)
*************** update_life_info_in_dirty_blocks (extent
*** 772,781 ****
        }
  
    if (n)
!     ndead = update_life_info (update_life_blocks, extent, prop_flags);
  
    sbitmap_free (update_life_blocks);
!   return ndead;
  }
  
  /* Free the variables allocated by find_basic_blocks.
--- 772,781 ----
        }
  
    if (n)
!     retval = update_life_info (update_life_blocks, extent, prop_flags);
  
    sbitmap_free (update_life_blocks);
!   return retval;
  }
  
  /* Free the variables allocated by find_basic_blocks.



More information about the Gcc-patches mailing list